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


Java PGraphics.line方法代碼示例

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


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

示例1: drawPoint

import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawPoint(PGraphics pg, int idx, float left, float top, float width, float height)
{
	if (m_Images[idx] != null)
	{
		try
		{
 			pg.imageMode(PApplet.CORNER);
			pg.image(m_Images[idx], left, top, width, height);
		}
		catch (Exception e)
		{
		}
	}
	else
	{
		// just draw an empty rect with a cross
		pg.stroke(0);
		pg.rect(left, top, width, height);
		pg.line(left, top, left + width, top + height);
		pg.line(left + width, top, left, top + height);
	}
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:23,代碼來源:MetadataImageViewer.java

示例2: drawCutOffMax

import processing.core.PGraphics; //導入方法依賴的package包/類
void drawCutOffMax(PGraphics gx)
{
	float cutoff = (float)m_Framework.getGroup(m_iGroupIndex, true).m_CutOffMax;
	float thresholdLineY = m_LargeRect.bottom() - m_LargeRect.height() * (cutoff - 1 + m_ZoomCoord.bottom()) / (m_ZoomCoord.bottom() - m_ZoomCoord.top());
	float topVal = 1 - m_ScrollY.value();
	float bottomVal = 1 - (m_ScrollY.value() + m_ScrollY.getVisibleAmount());
	
	float gradTop = cutoff > topVal ? m_CuttOffRect.top() : thresholdLineY;
	
	DrawUtils.gradientRect(gx, (int)m_CuttOffRect.left(), (int)gradTop, 
			m_CuttOffRect.width(), m_CuttOffRect.bottom() - gradTop,
			gx.lerpColor(dp.hmColor0, dp.hmColor1, cutoff > topVal ? topVal / cutoff : 1), 
			gx.lerpColor(dp.hmColor0, dp.hmColor1, bottomVal / cutoff), 
			DrawUtils.Y_AXIS);
	
	gx.noFill();
	gx.rect(m_CuttOffRect.left(), m_CuttOffRect.top(), m_CuttOffRect.width(), m_CuttOffRect.height());
		
	if (1 - cutoff > m_ZoomCoord.top() && 1 - cutoff < m_ZoomCoord.bottom())
	{// draw the cuttoff max line
		gx.strokeWeight(3);
		gx.line(m_CuttOffRect.left(), thresholdLineY, m_CuttOffRect.right(), thresholdLineY);
	}
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:25,代碼來源:ControlPanelDetailPlot.java

示例3: 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

示例4: 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

示例5: drawSpawnTrack

import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawSpawnTrack(PGraphics pg){
  if(is_active){
    pg.strokeWeight(1f / transform.screen_scale);
    pg.stroke(200,128,128, 128);
    pg.line(bomb_spawn_start.x, bomb_spawn_start.y, bomb_spawn_end.x, bomb_spawn_end.y);
  }
}
 
開發者ID:diwi,項目名稱:LiquidFunProcessing,代碼行數:8,代碼來源:DwMouseShootBullet.java

示例6: 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

示例7: drawArrow

import processing.core.PGraphics; //導入方法依賴的package包/類
public static void drawArrow(PGraphics p, float x1, float y1, float x2, float y2, float dx, float dy, boolean bDrawArrowLine)
{
	if (bDrawArrowLine) {
		p.line(x1, y1, x2, y2);
	}
	p.pushMatrix();
	p.translate(x2, y2);
	float a = (float)Math.atan2(x1-x2, (y2-y1)*0.1f);
	p.rotate(a);
	p.line(0, 0, -dy, -dx);
	p.line(0, 0, dy, -dx);
	p.popMatrix();
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:14,代碼來源:PUtils.java

示例8: drawProfile

import processing.core.PGraphics; //導入方法依賴的package包/類
public static void drawProfile(PGraphics p, double[] values, double dMin, double dMax, float fLeft, float fTop, float fWidth, float fHeight, boolean bFilled)
{
	if (values == null || values.length == 0 || dMax - dMin <= 0)
		return;
	
	float fPrevX = 0;
	float fPrevY = 0;
	
	for (int i = 0; i < values.length; i++)
	{
		float fW = fWidth / (values.length - 1);
		float fH = (float)Math.min(fHeight, (values[i] - dMin) * fHeight / (dMax - dMin));
		float fX = i * fW + fLeft;
		float fY = (float)(fTop + fHeight - fH);

		if (bFilled)
		{
			p.rect(fX, fTop + fHeight, fW, -fH);
		}
		else if (i > 0)
		{
			p.line (fPrevX, fPrevY, fX, fY);
		}
		fPrevX = fX;
		fPrevY = fY;
	}	

}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:29,代碼來源:PUtils.java

示例9: drawPointDetailed

import processing.core.PGraphics; //導入方法依賴的package包/類
public void drawPointDetailed(PGraphics pg, int idx, float left, float top, float width, float height)
{
	if (m_iMetaDataColIndex == -1)
		return;
	
	if (m_iDetailedPointIndex != idx)
	{
		m_DetailedImage = null;
		s_DetailedPointMetaData = m_Operator.getMetaData(m_iMetaDataColIndex, idx);
		try
		{
			if ((new File(m_sFilePath + s_DetailedPointMetaData)).exists())
			{
				m_DetailedImage = m_Applet.loadImage(m_sFilePath + s_DetailedPointMetaData);
			}
		}
		catch (Exception e)
		{
		}
		m_iDetailedPointIndex = idx;
	}
	
	if (m_DetailedImage != null)
	{
			pg.imageMode(PApplet.CORNER);
		pg.image(m_DetailedImage, left, top, width, height);
	}
	else
	{
		// just draw an empty rect with a cross
		pg.stroke(128);
		pg.rect(left, top, width, height);
		pg.line(left, top, left + width, top + height);
		pg.line(left + width, top, left, top + height);
	}
}
 
開發者ID:hyounesy,項目名稱:ChAsE,代碼行數:37,代碼來源:MetadataImageViewer.java

示例10: 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

示例11: apply

import processing.core.PGraphics; //導入方法依賴的package包/類
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
  
  List<Object> params = ProcessingUtil.parseParams(stack, 4, 6);
      
  PGraphics pg = (PGraphics) params.get(0);
  
  if (pg.is3D() && 7 != params.size()) {
    throw new WarpScriptException(getName() + " missing z-coordinates.");
  }
  
  if (pg.is3D()) {
    pg.line(
        ((Number) params.get(1)).floatValue(),
        ((Number) params.get(2)).floatValue(),
        ((Number) params.get(3)).floatValue(),
        ((Number) params.get(4)).floatValue(),
        ((Number) params.get(5)).floatValue(),
        ((Number) params.get(6)).floatValue()
    );
  } else {
    pg.line(
        ((Number) params.get(1)).floatValue(),
        ((Number) params.get(2)).floatValue(),
        ((Number) params.get(3)).floatValue(),
        ((Number) params.get(4)).floatValue()
    );
  }
  
  stack.push(pg);
      
  return stack;
}
 
開發者ID:cityzendata,項目名稱:warp10-platform,代碼行數:34,代碼來源:Pline.java


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