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


Java Rectangle.getMinY方法代碼示例

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


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

示例1: getShape

import java.awt.Rectangle; //導入方法依賴的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: rasterize

import java.awt.Rectangle; //導入方法依賴的package包/類
/**
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterize(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {

	// create the buffered image of the size of the Rectangle
    BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_BINARY);
    GeometryFactory gf = new GeometryFactory();

    // define the clipping region in full scale
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};

    Polygon geom = gf.createPolygon(gf.createLinearRing(coords));

    Graphics g2d = image.getGraphics();

    g2d.setColor(Color.white);
    for (Geometry p : maskGeometries) {
    	/*if(p instanceof MultiPolygon){
    		p=p.getBoundary();
    	}*/
        if (p.intersects(geom)) {
            int[] xPoints = new int[p.getNumPoints()];//build array for x coordinates
            int[] yPoints = new int[p.getNumPoints()];//build array for y coordinates
            int i = 0;
            for (Coordinate c : p.getCoordinates()) {
                xPoints[i] = (int) ((c.x + offsetX ) * scalingFactor);
                yPoints[i] = (int) ((c.y + offsetY ) * scalingFactor);
                i++;
            }
            g2d.fillPolygon(xPoints, yPoints, i);
        }
    }
    g2d.dispose();
    return image;

}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:43,代碼來源:MaskGeometries.java

示例3: rasterize

import java.awt.Rectangle; //導入方法依賴的package包/類
public BufferedImage rasterize(BufferedImage image, int offsetX, int offsetY, double scalingFactor) {
    Rectangle rect = image.getRaster().getBounds();
    GeometryFactory gf = new GeometryFactory();
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor) + offsetX), (int) (((double) rect.getMinY() / scalingFactor) + offsetY)),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor) + offsetX), (int) (((double) rect.getMinY() / scalingFactor) + offsetY)),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor) + offsetX), (int) (((double) rect.getMaxY() / scalingFactor) + offsetY)),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor) + offsetX), (int) (((double) rect.getMaxY() / scalingFactor) + offsetY)),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor) + offsetX), (int) (((double) rect.getMinY() / scalingFactor) + offsetY)),
    };
    Polygon geom = gf.createPolygon(gf.createLinearRing(coords), null);
    Graphics g2d = image.getGraphics();
    g2d.setColor(Color.WHITE);
    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 - offsetX) * scalingFactor);
                yPoints[i++] = (int) ((c.y - offsetY) * scalingFactor);
            }
            g2d.fillPolygon(xPoints, yPoints, p.getNumPoints());
        }
    }
    g2d.dispose();
    return image;
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:29,代碼來源:InterpolatedVectorLayer.java

示例4: scrollNow

import java.awt.Rectangle; //導入方法依賴的package包/類
/**
 * Start scrolling.
 */
private void scrollNow() {
	if (mouseOnScreenPoint != null && target.isShowing()) {
		Point origin = target.getLocationOnScreen();
		Point relative = new Point(mouseOnScreenPoint.x - origin.x, mouseOnScreenPoint.y - origin.y);

		Rectangle visibleRect = target.getVisibleRect();

		if (!visibleRect.contains(relative)) {
			int destX = relative.x;
			if (relative.getX() < visibleRect.getMinX()) {
				destX = (int) visibleRect.getMinX() - PAN_STEP_SIZE;
			}
			if (relative.getX() > visibleRect.getMaxX()) {
				destX = (int) visibleRect.getMaxX() + PAN_STEP_SIZE;
			}

			int destY = relative.y;
			if (relative.getY() < visibleRect.getMinY()) {
				destY = (int) visibleRect.getMinY() - PAN_STEP_SIZE;
			}
			if (relative.getY() > visibleRect.getMaxY()) {
				destY = (int) visibleRect.getMaxY() + PAN_STEP_SIZE;
			}

			target.scrollRectToVisible(new Rectangle(new Point(destX, destY)));
		}
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:32,代碼來源:PanningManager.java

示例5: rasterizeJTS

import java.awt.Rectangle; //導入方法依賴的package包/類
/**
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public BufferedImage rasterizeJTS(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {

	// create the buffered image of the size of the Rectangle
    BufferedImage image = new BufferedImage(rect.width, rect.height, BufferedImage.TYPE_BYTE_BINARY);
    GeometryFactory gf = new GeometryFactory();

    // define the clipping region in full scale
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};

    Polygon geom = gf.createPolygon(gf.createLinearRing(coords));

    for (Geometry p : maskGeometries) {
        if (p.intersects(geom)) {
        	Geometry pg=p.intersection(geom).buffer(0);
        	//Coordinate[] coordsInter=gg.getCoordinates();
        	//Polygon pg=gf.createPolygon(coordsInter);

        	for(int x=0;x<rect.width;x++){
        		for(int y=0;y<rect.height;y++){
        			Point point=gf.createPoint(new Coordinate(rect.x+x,rect.y+y));
        			if(pg.contains(point)){
          		try{
          			image.setRGB(x,y, Color.WHITE.getRGB());
          		}catch(Exception e){
          			logger.error(e.getMessage()+"  x:"+x+"  y:"+y);
          		}
        			}
         	}
         }
     }
    }
    return image;

}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:43,代碼來源:MaskGeometries.java

示例6: getShape

import java.awt.Rectangle; //導入方法依賴的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

示例7: paint

import java.awt.Rectangle; //導入方法依賴的package包/類
public void paint(Graphics2D g, StateColorMap colorMap) {
  Rectangle bounds = g.getClipBounds();
  if (startY > bounds.getMaxY() || startY + height < bounds.getMinY()) {
    return;
  }

  int x = line.getX();
  int width = line.getWidth();

  Color color = colorMap.getColor(stateName);
  g.setColor(color);
  g.fillRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
  g.setColor(Color.BLACK);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:15,代碼來源:LifelineState.java

示例8: highlight

import java.awt.Rectangle; //導入方法依賴的package包/類
public void highlight(Graphics2D g) {
  Rectangle bounds = g.getClipBounds();
  if (startY > bounds.getMaxY() || startY + height < bounds.getMinY()) {
    return;
  }

  int x = line.getX();
  int width = line.getWidth();

  g.drawRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:12,代碼來源:LifelineState.java

示例9: mouseClicked

import java.awt.Rectangle; //導入方法依賴的package包/類
public void mouseClicked(MouseEvent mevt) {
	if ( !mevt.getSource().equals(testGraph) && mevt.getSource() instanceof org.geomapapp.util.CustomXYGraph ) {
		CustomXYGraph tempGraph = (CustomXYGraph)mevt.getSource();
		Rectangle r = tempGraph.getVisibleRect();
		if ( mevt.getX() + tempGraph.getX() > tempGraph.getX() + r.width - 10 && mevt.getX() + tempGraph.getX() < tempGraph.getX() + r.width && mevt.getY() > r.getMinY() && mevt.getY() < r.getMinY() + 10 ) {
			int tempHeight = testDialog.getHeight();
			int tempWidth = testDialog.getWidth();
			testBox.remove(tempGraph);
			testDialog.setSize( tempWidth - max_Width, tempHeight );
			testDialog.setVisible(true);
			tempGraph.removeMouseListener(this);
			tempGraph = null;
		}
	}
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:16,代碼來源:CustomGraph.java

示例10: rasterMaskJTS

import java.awt.Rectangle; //導入方法依賴的package包/類
/**
 * rasterize the mask clipped with the Rectangle scaled back to full size with an offset onto a BufferedImage
 */
public int[] rasterMaskJTS(Rectangle rect, int offsetX, int offsetY, double scalingFactor) {

	// create the buffered image of the size of the Rectangle
    int[] mask = new int[rect.width* rect.height];
    GeometryFactory gf = new GeometryFactory();

    // define the clipping region in full scale
    Coordinate[] coords = new Coordinate[]{
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMaxX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMaxY() / scalingFactor))),
        new Coordinate((int) (((double) rect.getMinX() / scalingFactor)), (int) (((double) rect.getMinY() / scalingFactor))),};

    Polygon geom = gf.createPolygon(gf.createLinearRing(coords));
    PreparedPolygon ppol=new PreparedPolygon(geom);

    int numPix=rect.width*rect.height;
    for (Geometry p : maskGeometries) {
        if (ppol.intersects(p)) {
        	Geometry pg=p.intersection(geom).buffer(0);
        	IndexedPointInAreaLocator locator=new IndexedPointInAreaLocator(pg);


        	int x=0;
        	int y=0;

        	for(int ii=0;ii<numPix;ii++){
        		if(ii%rect.width==0){
        			x=0;
        			y++;
        		}
    			//Point point=gf.createPoint(new Coordinate(rect.x+x,rect.y+y));
    			//PreparedPoint ppoint=new PreparedPoint(point);
    			//if(ppoint.within(pg)){
        		int loc=locator.locate(new Coordinate(rect.x+x,rect.y+y));
        		if(loc==Location.INTERIOR||loc==Location.BOUNDARY)
         		try{
         			mask[x]=1;
         		}catch(Exception e){
         			logger.warn(e.getMessage()+"  x:"+x+"  y:"+y);
         		}
    			}
         }
     //}
    }
    return mask;

}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:53,代碼來源:MaskGeometries.java


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