当前位置: 首页>>代码示例>>Java>>正文


Java Area.add方法代码示例

本文整理汇总了Java中java.awt.geom.Area.add方法的典型用法代码示例。如果您正苦于以下问题:Java Area.add方法的具体用法?Java Area.add怎么用?Java Area.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.Area的用法示例。


在下文中一共展示了Area.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getShape

import java.awt.geom.Area; //导入方法依赖的package包/类
public Area getShape() {
    Area maskArea = new Area();
    Rectangle rect = new Rectangle(0, 0, reader.getWidth(), reader.getHeight());
    GeometryFactory gf = new GeometryFactory();
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) rect.getMinX(), (int) rect.getMinY()),
        new Coordinate((int) rect.getMaxX(), (int) rect.getMinY()),
        new Coordinate((int) rect.getMaxX(), (int) rect.getMaxY()),
        new Coordinate((int) rect.getMinX(), (int) rect.getMaxY()),
        new Coordinate((int) rect.getMinX(), (int) rect.getMinY()),
    };
    Polygon geom = gf.createPolygon(gf.createLinearRing(coords), null);
    for (Geometry p : glayer.getGeometries()) {
        if (p.intersects(geom)) {
            int[] xPoints = new int[p.getNumPoints()];
            int[] yPoints = new int[p.getNumPoints()];
            int i = 0;
            for (Coordinate c : p.getCoordinates()) {
                xPoints[i] = (int) (c.x);
                yPoints[i++] = (int) (c.y);
            }
            maskArea.add(new Area(new java.awt.Polygon(xPoints, yPoints, p.getNumPoints())));
        }
    }
    return maskArea;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:27,代码来源:InterpolatedVectorLayer.java

示例2: getDropIndication

import java.awt.geom.Area; //导入方法依赖的package包/类
/**
 * Get a shape appropriate for drawing on the window's glass pane to
 * indicate where a component should appear in the tab order if it is
 * dropped here.
 *
 * @param dragged An object being dragged, or null. The object may be an
 * instance of
 * <code>TabData</code> or
 * <code>Component</code>, in which case a check will be done of whether the
 * dragged object is already in the data model, so that attempts to drop the
 * object over the place it already is in the model will always return the
 * exact indication of that tab's position.
 *
 * @param location A point
 * @return Drop indication drawing
 */
public Shape getDropIndication( Object dragged, Point location ) {
    int over = dropIndexOfPoint( location );
    Rectangle component = getSelectedComponent().getBounds();
    Area selectedComponent = new Area( component );

    Rectangle firstTab = null, secondTab = null;
    if( over > 0 && over < getTabCount() )
        firstTab = getBoundsAt( over-1 );
    if( over < getTabCount() )
        secondTab = getBoundsAt( over );
    if( over >= getTabCount() ) {
        firstTab = getBoundsAt( getTabCount()-1 );
        secondTab = null;
    }
    Rectangle joined = joinTabAreas( firstTab, secondTab );
    Area t = new Area( joined );
    selectedComponent.add( t );
    return selectedComponent;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:JTabbedPaneAdapter.java

示例3: getArea

import java.awt.geom.Area; //导入方法依赖的package包/类
public Area getArea(MapShader shader) {
  Area a = null;
  final MapShader.ShadedPiece shaded = (MapShader.ShadedPiece) Decorator.getDecorator(piece,MapShader.ShadedPiece.class);
  if (shaded != null) {
    a = shaded.getArea(shader);
  }
  if (alwaysActive || active) {
    if (shader.getConfigureName().equals(mapShaderName)) {
      Area myArea = getArea();
      if (a == null) {
        a = myArea;
      }
      else {
        a.add(myArea);
      }
    }
  }
  return a;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:20,代码来源:AreaOfEffect.java

示例4: checkPiece

import java.awt.geom.Area; //导入方法依赖的package包/类
protected void checkPiece(Area area, GamePiece piece) {
  if (piece instanceof Stack) {
    Stack s = (Stack) piece;
    for (int i = 0; i < s.getPieceCount(); i++) {
      checkPiece(area, s.getPieceAt(i));
    }
  }
  else {
    ShadedPiece shaded = (ShadedPiece) Decorator.getDecorator(piece,ShadedPiece.class);
    if (shaded != null) {
      Area shape = shaded.getArea(this);
      if (shape != null) {
        if (type.equals(FG_TYPE)) {
          area.add(shape);
        }
        else {
          area.subtract(shape);
        }
      }
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:23,代码来源:MapShader.java

示例5: updateArea

import java.awt.geom.Area; //导入方法依赖的package包/类
public static void updateArea(final List<MatOfPoint> contours, final Mat hierarchy, final Area area, int row, int depth) {
	while (row >= 0) {
		int[] data = new int[4];
		hierarchy.get(0, row, data);
		
		MatOfPoint contour = contours.get(row);
		
		// Don't include isolated pixels - otherwise add or remove, as required
		if (contour.height() > 2) {
			Path2D path = getContour(contour);
			if (depth % 2 == 0)
				area.add(new Area(path));
			else
				area.subtract(new Area(path));
		}
		
		// Deal with any sub-contours
		if (data[2] >= 0)
			updateArea(contours, hierarchy, area, data[2], depth+1);
		
		// Move to next contour in this hierarchy level
		row = data[0];
	}
}
 
开发者ID:qupath,项目名称:qupath,代码行数:25,代码来源:DetectCytokeratinCV.java

示例6: draw

import java.awt.geom.Area; //导入方法依赖的package包/类
public void draw(Graphics2D g2) {

        Area area = new Area();
        if (visible)
            for (AtsOperator op : selection) {

                g2.setStroke(focusRectStroke);
                g2.setColor(focusRectColor);

                // g2.drawRect(op.getX()+offset.x,op.getY()+offset.y,
                // op.getWidth()-1, op.getHeight()-1);

                area.add(new Area(new Rectangle2D.Double(op.getX() + offset.x, op.getY() + offset.y, op.getWidth(),
                        op.getHeight())));

            }
        // g2.draw(getDaisyShape());
        g2.draw(area);

        Composite original = g2.getComposite();
        AlphaComposite ac1 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f);

        g2.setComposite(ac1);
        g2.fill(area);
        g2.setComposite(original);
    }
 
开发者ID:jdiemke,项目名称:XPTS,代码行数:27,代码来源:GroupSelection.java

示例7: nakresli

import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
void nakresli() {
	vystreduj();

	// Area a1 = new Area([triangle 0,0 => 8,0 => 0,8]);
	// Area a2 = new Area([triangle 0,0 => 8,0 => 8,8]);
	// a1.add(a2);
	final Area poly = new Area(new Polygon(new int[] { 0, 1, 1, 5, 0 }, new int[] { 0, 1, 7, 7, 12 }, 5));
	final Area a = new Area();

	final AffineTransform rotace = new AffineTransform();
	rotace.rotate(Math.PI / 2);
	final AffineTransform zrcadlo = new AffineTransform();
	zrcadlo.scale(1, -1);
	for (int i = 0; i < 4; i++) {
		a.transform(zrcadlo);
		a.add(poly);
		a.transform(zrcadlo);
		a.add(poly);
		a.transform(rotace);
	}
	g.setColor(Color.GREEN);
	g.fill(a);
	g.setColor(Color.BLACK);
	g.draw(a);
}
 
开发者ID:marvertin,项目名称:geokuk,代码行数:27,代码来源:FKurzory.java

示例8: NotEqualsSignNode

import java.awt.geom.Area; //导入方法依赖的package包/类
public NotEqualsSignNode() {
    super();
    setStroke( new BasicStroke( 1f ) );
    setStrokePaint( Color.BLACK );
    setPaint( BCEConstants.UNBALANCED_COLOR );

    Shape topBarShape = new Rectangle2D.Double( 0, 0, EqualsSignNode.BAR_WIDTH, EqualsSignNode.BAR_HEIGHT );
    Shape bottomBarShape = new Rectangle2D.Double( 0, EqualsSignNode.BAR_HEIGHT + EqualsSignNode.BAR_Y_SPACING, EqualsSignNode.BAR_WIDTH, EqualsSignNode.BAR_HEIGHT );

    Rectangle2D r = new Rectangle2D.Double( 0, EqualsSignNode.BAR_HEIGHT + ( ( EqualsSignNode.BAR_Y_SPACING - EqualsSignNode.BAR_HEIGHT ) / 2 ), EqualsSignNode.BAR_WIDTH, EqualsSignNode.BAR_HEIGHT );
    AffineTransform t2 = AffineTransform.getRotateInstance( Math.toRadians( -75 ), EqualsSignNode.BAR_WIDTH / 2, EqualsSignNode.BAR_HEIGHT + ( EqualsSignNode.BAR_Y_SPACING / 2 ) );
    Shape slashShape = t2.createTransformedShape( r );

    Area area = new Area( topBarShape );
    area.add( new Area( slashShape ) );
    area.add( new Area( bottomBarShape ) );
    setPathTo( area );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:BarChartsNode.java

示例9: updateShapes

import java.awt.geom.Area; //导入方法依赖的package包/类
private void updateShapes(final ImagePlus imp) {

        lastSourceImage = imp;

        if (imp == null) {
            return;
        }

        // Prepare overlay
        final Overlay overlay = new Overlay();
        for (final Region region : regions) {

            final Area area = new Area();
            for (final SubRegion subRegion : region.getSubRegions()) {
                final Shape shape = ShapeUtils.toShape(subRegion.getRoi());
                area.add(new Area(shape));
            }
            final ShapeRoi roi = new ShapeRoi(area);
            roi.setStrokeColor(region.getColor());
            roi.setFillColor(region.getColor());
            roi.setName(region.getName());
            overlay.add(roi);
        }

        imp.setOverlay(overlay);
    }
 
开发者ID:ij-plugins,项目名称:ijp-toolkit,代码行数:27,代码来源:MultiRegionManagerModel.java

示例10: createPipeShape

import java.awt.geom.Area; //导入方法依赖的package包/类
private Shape createPipeShape() {
    
    final double pipeWidth = 31;
    final double horizontalLength = 20; // horizontal section of pipe
    final double verticalLength = 50; // vertical section of pipe
    final double elbowRadius = 20; // elbow where the horizontal and vertical sections are joined
    assert( elbowRadius < pipeWidth );
    
    Shape horizontalPipe = new Rectangle2D.Double( 0, 0, horizontalLength + elbowRadius, pipeWidth );
    Shape verticalPipe = new Rectangle2D.Double( horizontalLength, -verticalLength, pipeWidth, verticalLength + elbowRadius );
    Shape elbow = new RoundRectangle2D.Double( horizontalLength, 0, pipeWidth, pipeWidth, elbowRadius, elbowRadius );
    
    Area area = new Area( horizontalPipe );
    area.add( new Area( verticalPipe ) );
    area.add( new Area( elbow ) );
    return area;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:18,代码来源:DrainControlNode.java

示例11: TipNode

import java.awt.geom.Area; //导入方法依赖的package包/类
public TipNode() {
    super();
    
    // rounded corners at top
    Shape roundRect = new RoundRectangle2D.Float( 0f, 0f, 1f, 1.5f, 0.4f, 0.4f );
    
    // mask out rounded corners at bottom
    Shape rect = new Rectangle2D.Float( 0f, 0.5f, 1f, 1f );
    
    // point at the bottom
    GeneralPath triangle = new GeneralPath();
    triangle.moveTo( 0f, 1.5f );
    triangle.lineTo( 0.5f, 2.5f );
    triangle.lineTo( 1f, 1.5f );
    triangle.closePath();
    
    // constructive area geometry
    Area area = new Area( roundRect );
    area.add( new Area( rect ) );
    area.add( new Area( triangle ) );
    
    setPathTo( area );
    setPaint( TIP_COLOR );
    setStroke( null );
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:26,代码来源:PHProbeNode.java

示例12: getInstructions

import java.awt.geom.Area; //导入方法依赖的package包/类
@Override
public Transition2DInstruction[] getInstructions(float progress,
		Dimension size) {
	Shape[] data = getShapes(progress,size);
	Area area = new Area();
	for(int a = 0; a<data.length; a++) {
		Area newShape = new Area(data[a]);
		area.add(newShape);
	}

	float w = getStrokeWidth(progress, size);
	if(w==0) {
		return new Transition2DInstruction[] {
				new ImageInstruction(true),	
				new ImageInstruction(false,null,area)
		};
	} else {
		return new Transition2DInstruction[] {
				new ImageInstruction(true),	
				new ImageInstruction(false,null,area),
				new ShapeInstruction(area,null,Color.black,w)
		};
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:25,代码来源:AbstractClippedTransition2D.java

示例13: createStar

import java.awt.geom.Area; //导入方法依赖的package包/类
public static Shape createStar() {
	int s_2 = (int) Math.round(0.4 * SHAPE_SIZE);
	AffineTransform t = new AffineTransform();
	t.translate(0, s_2);

	Area area = new Area();
	area.add(new Area(createTriangular()));
	area.add(new Area(t.createTransformedShape(createTurnedTriangular())));
	return area;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:11,代码来源:SeriesFormat.java

示例14: getShape

import java.awt.geom.Area; //导入方法依赖的package包/类
public Area getShape(int width, int height) {
    Area maskArea = new Area();

    Rectangle rect = new Rectangle(0, 0, width,height);//reader.getWidth(), reader.getHeight());

    GeometryFactory gf = new GeometryFactory();
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) rect.getMinX(), (int) rect.getMinY()),
        new Coordinate((int) rect.getMaxX(), (int) rect.getMinY()),
        new Coordinate((int) rect.getMaxX(), (int) rect.getMaxY()),
        new Coordinate((int) rect.getMinX(), (int) rect.getMaxY()),
        new Coordinate((int) rect.getMinX(), (int) rect.getMinY()),};
    Polygon geom = gf.createPolygon(gf.createLinearRing(coords), null);
    for (Geometry p : glayer.getGeometries()) {
        if (p.intersects(geom)) {
            int[] xPoints = new int[p.getNumPoints()];
            int[] yPoints = new int[p.getNumPoints()];
            int i = 0;
            for (Coordinate c : p.getCoordinates()) {
                xPoints[i] = (int) (c.x);
                yPoints[i++] = (int) (c.y);
            }
            maskArea.add(new Area(new java.awt.Polygon(xPoints, yPoints, p.getNumPoints())));
        }
    }
    return maskArea;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:28,代码来源:MaskVectorLayer.java

示例15: getShape

import java.awt.geom.Area; //导入方法依赖的package包/类
public Shape getShape() {
  Area a = new Area();
  Shape[] childBounds = new Shape[getPieceCount()];
  StackMetrics metrics = getMap() == null ? getDefaultMetrics() : getMap().getStackMetrics();
  metrics.getContents(this, null, childBounds, null, 0, 0);
  final PieceIterator visibleFilter =
    PieceIterator.visible(getPiecesIterator());
  while (visibleFilter.hasMoreElements()) {
    GamePiece p = visibleFilter.nextPiece();
    a.add(new Area(childBounds[indexOf(p)]));
  }
  return a;
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:Stack.java


注:本文中的java.awt.geom.Area.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。