當前位置: 首頁>>代碼示例>>Java>>正文


Java PGraphics.popStyle方法代碼示例

本文整理匯總了Java中processing.core.PGraphics.popStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java PGraphics.popStyle方法的具體用法?Java PGraphics.popStyle怎麽用?Java PGraphics.popStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在processing.core.PGraphics的用法示例。


在下文中一共展示了PGraphics.popStyle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showTitle

import processing.core.PGraphics; //導入方法依賴的package包/類
/** 顯示選中的標記對應的城市名稱 */
public void showTitle(PGraphics pg, float x, float y)
{
	String name = getCity() + " " + getCountry() + " ";
	String pop = "Pop: " + getPopulation() + " Million";
	
	pg.pushStyle();
	
	pg.fill(255, 255, 255);
	pg.textSize(12);
	pg.rectMode(PConstants.CORNER);
	pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
	pg.fill(0, 0, 0);
	pg.textAlign(PConstants.LEFT, PConstants.TOP);
	pg.text(name, x+3, y-TRI_SIZE-33);
	pg.text(pop, x+3, y - TRI_SIZE -18);
	
	pg.popStyle();
}
 
開發者ID:simontangbit,項目名稱:CourseCode,代碼行數:20,代碼來源:CityMarker.java

示例2: draw

import processing.core.PGraphics; //導入方法依賴的package包/類
public void draw(PGraphics pg, java.util.List<MapPosition> mapPositions)
{
	if(!hidden)
	{
		pg.pushStyle();
		
		sourcescreen = source.getScreenPosition(map);
		destscreen = dest.getScreenPosition(map);
		
		pg.fill(150, 30, 30);
		pg.line(sourcescreen.x-xbase,sourcescreen.y-ybase,destscreen.x-xbase,destscreen.y-ybase);
		
		// Restore previous drawing style
		pg.popStyle();
	}
}
 
開發者ID:prachi1210,項目名稱:air-travel-tracker,代碼行數:17,代碼來源:AirportRouteMarker.java

示例3: showTitle

import processing.core.PGraphics; //導入方法依賴的package包/類
/** Show the title of the earthquake if this marker is selected */
public void showTitle(PGraphics pg, float x, float y)
{
	String title = getTitle();
	pg.pushStyle();
	
	pg.rectMode(PConstants.CORNER);
	
	pg.stroke(110);
	pg.fill(255,255,255);
	pg.rect(x, y + 15, pg.textWidth(title) +6, 18, 5);
	
	pg.textAlign(PConstants.LEFT, PConstants.TOP);
	pg.fill(0);
	pg.text(title, x + 3 , y +18);
	
	
	pg.popStyle();
	
}
 
開發者ID:snavjivan,項目名稱:Earthquake-Tracker,代碼行數:21,代碼來源:EarthquakeMarker.java

示例4: showTitle

import processing.core.PGraphics; //導入方法依賴的package包/類
public void showTitle(PGraphics pg, float x, float y)
{
	String name = getCity() + " " + getCountry() + " ";
	String pop = "Pop: " + getPopulation() + " Million";
	
	pg.pushStyle();
	
	pg.fill(255, 255, 255);
	pg.textSize(12);
	pg.rectMode(PConstants.CORNER);
	pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
	pg.fill(0, 0, 0);
	pg.textAlign(PConstants.LEFT, PConstants.TOP);
	pg.text(name, x+3, y-TRI_SIZE-33);
	pg.text(pop, x+3, y - TRI_SIZE -18);
	
	pg.popStyle();
}
 
開發者ID:snavjivan,項目名稱:Earthquake-Tracker,代碼行數:19,代碼來源:CityMarker.java

示例5: showTitle

import processing.core.PGraphics; //導入方法依賴的package包/類
/** Show the title of the city if this marker is selected */
public void showTitle(PGraphics pg, float x, float y)
{
	String name = getCity() + " " + getCountry() + " ";
	String pop = "Pop: " + getPopulation() + " Million";
	
	pg.pushStyle();
	
	pg.fill(255, 255, 255);
	pg.textSize(12);
	pg.rectMode(PConstants.CORNER);
	pg.rect(x, y-TRI_SIZE-39, Math.max(pg.textWidth(name), pg.textWidth(pop)) + 6, 39);
	pg.fill(0, 0, 0);
	pg.textAlign(PConstants.LEFT, PConstants.TOP);
	pg.text(name, x+3, y-TRI_SIZE-33);
	pg.text(pop, x+3, y - TRI_SIZE -18);
	
	pg.popStyle();
}
 
開發者ID:imranalidigi,項目名稱:UCSDUnfoldingMapsMaven,代碼行數:20,代碼來源:CityMarker.java

示例6: drawAttribution

import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawAttribution(PGraphics pGraphics) {
	String name = "(C) OpenStreetMap contributors - www.openstreetmap.org/copyright";
	float x = 580;
	float y = 680;
	float spaceWidth = pGraphics.textWidth(" ");
	float textHeight = pGraphics.textAscent() + pGraphics.textDescent();
	float toolTipWidth = pGraphics.textWidth(" " + name + " ");
	float toolTipHeight = textHeight;
	pGraphics.pushStyle();
		pGraphics.noStroke();
		pGraphics.fill(255, 255, 255, 30);
		pGraphics.rect(x, y, toolTipWidth, toolTipHeight);
		pGraphics.fill(0, 0, 0);
		pGraphics.text(name, x + spaceWidth, y + pGraphics.textAscent());
	pGraphics.popStyle();		
}
 
開發者ID:IBM-Cloud,項目名稱:map-driver-insights,代碼行數:17,代碼來源:ToolTipMarker.java

示例7: drawToolTip

import processing.core.PGraphics; //導入方法依賴的package包/類
private void drawToolTip(PGraphics pGraphics, float x, float y) {
	x = 20;
	y = 20;
	float spaceWidth = pGraphics.textWidth(" ");
	float textHeight = pGraphics.textAscent() + pGraphics.textDescent();
	float toolTipWidth = pGraphics.textWidth(name) * 11 / 10;
	int toolTipLines = name.length() - name.replace("\n", "").length() + 1;
	float toolTipHeight = textHeight * toolTipLines;
	pGraphics.pushStyle();
		pGraphics.noStroke();
		pGraphics.fill(255, 255, 255);
		pGraphics.rect(x, y, toolTipWidth, toolTipHeight);
		pGraphics.fill(0, 0, 0);
		pGraphics.text(name, x + spaceWidth, y + textHeight);
	pGraphics.popStyle();		
}
 
開發者ID:IBM-Cloud,項目名稱:map-driver-insights,代碼行數:17,代碼來源:ToolTipMarker.java

示例8: showTitle

import processing.core.PGraphics; //導入方法依賴的package包/類
public void showTitle(PGraphics pg, float x, float y) {
	 // show rectangle with title
	// show routes
	
	String id = "ID : " + getId();
	String name = getName();
	
	pg.pushStyle();
	pg.fill(255,255,255);
	pg.textSize(12);
	pg.rectMode(PConstants.CORNER);
	pg.rect(x,y-8*radius,Math.max(pg.textWidth(id),pg.textWidth(name))+6,8*radius);
	pg.fill(0,0,0);
	pg.textAlign(PConstants.LEFT,PConstants.TOP);
	pg.text(id,x+3,y-7*radius);
	pg.text(name,x+3,y-4*radius);
	
	pg.popStyle();
}
 
開發者ID:prachi1210,項目名稱:air-travel-tracker,代碼行數:20,代碼來源:AirportMarker.java

示例9: drawMarker

import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
	// 保存之前的風格
	pg.pushStyle();
		
	// 根據地震深度來確定標記的顏色
	colorDetermine(pg);
	
	// 調用子類中實現的抽象方法來繪製標記形狀
	drawEarthquake(pg, x, y);
	
	// IMPLEMENT: add X over marker if within past day		
	String age = getStringProperty("age");
	if ("Past Hour".equals(age) || "Past Day".equals(age)) {
		
		pg.strokeWeight(2);
		int buffer = 2;
		pg.line(x-(radius+buffer), 
				y-(radius+buffer), 
				x+radius+buffer, 
				y+radius+buffer);
		pg.line(x-(radius+buffer), 
				y+(radius+buffer), 
				x+radius+buffer, 
				y-(radius+buffer));
		
	}
	
	// 恢複之前的風格
	pg.popStyle();
	
}
 
開發者ID:simontangbit,項目名稱:CourseCode,代碼行數:33,代碼來源:EarthquakeMarker.java

示例10: drawMarker

import processing.core.PGraphics; //導入方法依賴的package包/類
/**
 * 在地圖上繪製標記
 */
public void drawMarker(PGraphics pg, float x, float y) {
	// 保存之前的繪製風格
	pg.pushStyle();
	
	// 為每個城市繪製一個三角形標記
	pg.fill(150, 30, 30);
	pg.triangle(x, y-TRI_SIZE, x-TRI_SIZE, y+TRI_SIZE, x+TRI_SIZE, y+TRI_SIZE);
	
	// 恢複之前的繪製風格
	pg.popStyle();
}
 
開發者ID:simontangbit,項目名稱:CourseCode,代碼行數:15,代碼來源:CityMarker.java

示例11: draw

import processing.core.PGraphics; //導入方法依賴的package包/類
/**
 * 在地圖上繪製標記
 */
public void draw(PGraphics pg, float x, float y) {
	// 保存之前的繪製風格
	pg.pushStyle();
	
	// TODO: 添加代碼實現繪製三角形用於表示CityMarker
	// 提示: pg是可以用來調用圖形方法的對象.  例如 pg.fill(255, 0, 0)可以設置顏色為紅色
	// x和y是所繪製對象的中心,用於計算出坐標並傳遞給圖形繪製方法.  
	// 例如pg.rect(x, y, 10, 10)將繪製一個10x10的正方形,左上角坐標為x, y
	// 其它方法可以參考processing庫的文檔
	
	
	// 恢複之前的繪製風格
	pg.popStyle();
}
 
開發者ID:simontangbit,項目名稱:CourseCode,代碼行數:18,代碼來源:CityMarker.java

示例12: drawMarker

import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
	// save previous styling
	pg.pushStyle();
		
	// determine color of marker from depth
	colorDetermine(pg);
	
	// call abstract method implemented in child class to draw marker shape
	drawEarthquake(pg, x, y);
	
	String age = getStringProperty("age");
	if ("Past Hour".equals(age) || "Past Day".equals(age)) {
		
		pg.strokeWeight(2);
		int buffer = 2;
		pg.line(x-(radius+buffer), 
				y-(radius+buffer), 
				x+radius+buffer, 
				y+radius+buffer);
		pg.line(x-(radius+buffer), 
				y+(radius+buffer), 
				x+radius+buffer, 
				y-(radius+buffer));
		
	}
	
	// reset to previous styling
	pg.popStyle();
	
}
 
開發者ID:snavjivan,項目名稱:Earthquake-Tracker,代碼行數:32,代碼來源:EarthquakeMarker.java

示例13: drawMarker

import processing.core.PGraphics; //導入方法依賴的package包/類
/**
 * Implementation of method to draw marker on the map.
 */
public void drawMarker(PGraphics pg, float x, float y) {
	// Save previous drawing style
	pg.pushStyle();
	
	//draw a triangle for each city
	pg.fill(150, 30, 30);
	pg.triangle(x, y-TRI_SIZE, x-TRI_SIZE, y+TRI_SIZE, x+TRI_SIZE, y+TRI_SIZE);
	
	// Restore previous drawing style
	pg.popStyle();
}
 
開發者ID:snavjivan,項目名稱:Earthquake-Tracker,代碼行數:15,代碼來源:CityMarker.java

示例14: checkbox

import processing.core.PGraphics; //導入方法依賴的package包/類
static boolean checkbox(PGraphics gx, float left, float top, boolean checked)
{
	boolean bClicked = false;
	
	if (m_MouseState.clickedInside(MouseState.LEFT, left, top, CHECKBOX_SIZE, CHECKBOX_SIZE)) {
		bClicked = true;
		checked = !checked;
	}
	
	gx.pushStyle();
	try{
		gx.fill(255);
		gx.stroke(m_MouseState.isStartIn(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE) &&
				  m_MouseState.isIn(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE) ? 0xFFFF0000 : 0);
		gx.rect(left, top, CHECKBOX_SIZE, CHECKBOX_SIZE);
		gx.fill(0);
		if (checked)
		{
			gx.textFont(dp.fontGuiFx);
			gx.textSize(CHECKBOX_SIZE);
			gx.textAlign(PConstants.CENTER, PConstants.CENTER);
			gx.text("z", left + CHECKBOX_SIZE/2, top + CHECKBOX_SIZE/2);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	gx.popStyle();
	return bClicked;
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:31,代碼來源:GuiUtils.java

示例15: drawMarker

import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public void drawMarker(PGraphics pg, float x, float y) {
	// save previous styling
	pg.pushStyle();
		
	// determine color of marker from depth
	colorDetermine(pg);
	
	// call abstract method implemented in child class to draw marker shape
	drawEarthquake(pg, x, y);
	
	// IMPLEMENT: add X over marker if within past day		
	String age = getStringProperty("age");
	if ("Past Hour".equals(age) || "Past Day".equals(age)) {
		
		pg.strokeWeight(2);
		int buffer = 2;
		pg.line(x-(radius+buffer), 
				y-(radius+buffer), 
				x+radius+buffer, 
				y+radius+buffer);
		pg.line(x-(radius+buffer), 
				y+(radius+buffer), 
				x+radius+buffer, 
				y-(radius+buffer));
		
	}
	
	// reset to previous styling
	pg.popStyle();
	
}
 
開發者ID:imranalidigi,項目名稱:UCSDUnfoldingMapsMaven,代碼行數:33,代碼來源:EarthquakeMarker.java


注:本文中的processing.core.PGraphics.popStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。