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


Java Geometry.getCoordinate方法代碼示例

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


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

示例1: renderSquare

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public static void renderSquare(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,Geometry selectedGeometry,float renderWidth,Color color){
	GL2 gl = context.getGL().getGL2();
       float[] c = color.brighter().getColorComponents(null);
       gl.glColor3f(c[0], c[1], c[2]);

	for (Geometry temp : geometries) {
           gl.glLineWidth(temp == selectedGeometry ? renderWidth * 3 : renderWidth);
           Coordinate point = new Coordinate(temp.getCoordinate());
           point.x = (point.x - context.getX()) / zoomWidth;
           point.y = 1 - (point.y - context.getY()) / zoomHeight;
           double rectwidth = 0.01;
           gl.glBegin(GL.GL_LINE_STRIP);
           gl.glVertex2d(point.x - rectwidth, point.y - rectwidth);
           gl.glVertex2d(point.x - rectwidth, point.y + rectwidth);
           gl.glVertex2d(point.x + rectwidth, point.y + rectwidth);
           gl.glVertex2d(point.x + rectwidth, point.y - rectwidth);
           gl.glVertex2d(point.x - rectwidth, point.y - rectwidth);
           gl.glEnd();
           gl.glFlush();
       }
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:22,代碼來源:GL2ShapesRender.java

示例2: renderCross

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public static void renderCross(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,Geometry selectedGeometry,float renderWidth,Color color){
	GL2 gl = context.getGL().getGL2();
       float[] c = color.brighter().getColorComponents(null);
       gl.glColor3f(c[0], c[1], c[2]);
       if(geometries!=null){
		for (Geometry temp : geometries) {
	        gl.glLineWidth(temp == selectedGeometry ? renderWidth * 2 : renderWidth);
	        Coordinate point = new Coordinate(temp.getCoordinate());
	        point.x = (point.x - context.getX()) / zoomWidth;
	        point.y = 1 - (point.y - context.getY()) / zoomHeight;
	        double rectwidth = 0.01;
	        gl.glBegin(GL.GL_LINE_STRIP);
	        gl.glVertex2d(point.x - rectwidth, point.y);
	        gl.glVertex2d(point.x + rectwidth, point.y);
	        gl.glEnd();
	        gl.glBegin(GL.GL_LINE_STRIP);
	        gl.glVertex2d(point.x, point.y - rectwidth);
	        gl.glVertex2d(point.x, point.y + rectwidth);
	        gl.glEnd();
	        gl.glFlush();
	    }
       }	
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:24,代碼來源:GL2ShapesRender.java

示例3: renderTriangle

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public static void renderTriangle(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,Geometry selectedGeometry,float renderWidth,Color color){
	GL2 gl = context.getGL().getGL2();
       float[] c = color.brighter().getColorComponents(null);
       gl.glColor3f(c[0], c[1], c[2]);
       if(geometries!=null){
		for (Geometry temp : geometries) {
	        gl.glLineWidth(temp == selectedGeometry ? renderWidth * 2 : renderWidth);
	        Coordinate point = new Coordinate(temp.getCoordinate());
	        point.x = (point.x - context.getX()) / zoomWidth;
	        point.y = 1 - (point.y - context.getY()) / zoomHeight;
	        double rectwidth = 0.01;
	        gl.glBegin(GL.GL_LINE_STRIP);
	        gl.glVertex2d(point.x - rectwidth, point.y - rectwidth);
	        gl.glVertex2d(point.x, point.y + rectwidth);
	        gl.glVertex2d(point.x + rectwidth, point.y - rectwidth);
	        gl.glVertex2d(point.x - rectwidth, point.y - rectwidth);
	        gl.glEnd();
	        gl.glFlush();
	    }
       }	
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:22,代碼來源:GL2ShapesRender.java

示例4: renderCircle

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public static void renderCircle(OpenGLContext context,float zoomWidth,float zoomHeight,List<Geometry>geometries,Geometry selectedGeometry,float size,Color color){
	GL2 gl = context.getGL().getGL2();
	float[] c = color.brighter().getColorComponents(null);
       gl.glColor3f(c[0], c[1], c[2]);
	gl.glBegin(GL.GL_POINTS);
   	
   	for (int ii=0;ii<geometries.size();ii++) {
   	   Geometry temp =geometries.get(ii);
   	   gl.glLineWidth(temp == selectedGeometry ? size * 2 : size);
   	   gl.glPointSize(temp == selectedGeometry ? size * 2 : size);
          Coordinate point = temp.getCoordinate();
          double dx=(point.x - context.getX()) / zoomWidth;
          double dy=1 - (point.y - context.getY()) / zoomHeight;
   	   for (int i=0; i < 360; i++){
   		   //double angle = 2 * Math.PI * i / 360;
   		   double xx = dx+Math.sin(i)*0.005;
   		   double yy = dy+Math.cos(i)*0.005;
   		   
   		   gl.glVertex2d(xx,yy);
   	   }
       } 
    gl.glEnd();
       gl.glFlush();
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:25,代碼來源:GL2ShapesRender.java

示例5: toggleRulers

import com.vividsolutions.jts.geom.Geometry; //導入方法依賴的package包/類
public void toggleRulers(int selectionLine) {
    if (selectionLine != -1) {
        if (vdslayer.tagExists(Constant.PREF_AZIMUTH_GEOMETRYTAG)) {
            vdslayer.removeGeometriesByTag(Constant.PREF_AZIMUTH_GEOMETRYTAG);
        } else {
        	try {
             // get the position of the boat
             Geometry geom = gl.getGeometries().get(selectionLine);
             int posX = (int) geom.getCoordinate().x;
             int posY = (int) geom.getCoordinate().y;
             // calculate satellite speed
             String tstart=((SarImageReader)il.getImageReader()).getTimeStampStart();
             String tstop=((SarImageReader)il.getImageReader()).getTimeStampStop();
             double seconds = ((Timestamp.valueOf(tstart).getTime() - (Timestamp.valueOf(tstop).getTime()))) / 1000;
             // calculate satellite speed in azimuth pixels / seconds
             double azimuthpixelspeed = (double) il.getImageReader().getHeight() / seconds;
             // calculate the earth angular speed
             double earthangularSpeed = 2 * Math.PI / 24 / 3600;
             // calculate earth radius at target point lattitude
             double radius;

	radius = 6400 * 1000 * Math.cos(2 * Math.PI * il.getImageReader().getGeoTransform().getGeoFromPixel(posX, posY)[1] / 360.0);
             // calculate the range azimuth pixel speed due to the rotation of the earth
             double rangepixelspeed = earthangularSpeed * radius / il.getImageReader().getPixelsize()[0];
             // calculate the pixels delta value
             double azi=((SarImageReader)il.getImageReader()).getImageAzimuth();
             double pixeldelta = 1 / (Math.cos(azi * 2 * Math.PI / 360.0) / (azimuthpixelspeed / rangepixelspeed - Math.sin(azi * 2 * Math.PI / 360.0)));
	
             // get the mode
             int direction = Math.abs(azi) > 90 ? -1 : 1;
             // create new geometry
             GeometryFactory gf = new GeometryFactory();
             // generate the geometry for the target shape
             List<Geometry> winGeom = new ArrayList<Geometry>();
             Coordinate[] coordinatesvertical = new Coordinate[2];
             coordinatesvertical[0] = new Coordinate(posX + direction * (0 - posY) / pixeldelta, 0);
             coordinatesvertical[1] = new Coordinate(posX + direction * (il.getImageReader().getHeight() - posY) / pixeldelta, il.getImageReader().getHeight());
             winGeom.add(gf.createLineString(coordinatesvertical));
             Coordinate[] coordinateshorizontal = new Coordinate[2];
             coordinateshorizontal[0] = new Coordinate(0, posY);
             coordinateshorizontal[1] = new Coordinate(il.getImageReader().getWidth(), posY);
             winGeom.add(gf.createLineString(coordinateshorizontal));
             vdslayer.addGeometries(Constant.PREF_AZIMUTH_GEOMETRYTAG, this.azimuthGeometrycolor, this.azimuthGeometrylinewidth, GeometryImage.LINESTRING, winGeom, true);
} catch (Exception e) {
	logger.error(e.getMessage());
}   
        }
    }
    SumoPlatform.getApplication().getGeoContext().setDirty(true);
}
 
開發者ID:ec-europa,項目名稱:sumo,代碼行數:51,代碼來源:GeometricInteractiveVDSLayerModel.java


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