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


Java Point类代码示例

本文整理汇总了Java中com.esri.arcgis.geometry.Point的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: buildFeature

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
private AvroFeature buildFeature(
        final AvroSpatialReference avroSpatialReference,
        final Map<CharSequence, Object> attributes,
        final Point point) throws IOException
{
    final AvroCoord avroCoord = AvroCoord.newBuilder().
            setX(point.getX()).
            setY(point.getY()).
            build();
    final AvroPoint avroPoint = AvroPoint.newBuilder().
            setSpatialReference(avroSpatialReference).
            setCoord(avroCoord).
            build();
    return AvroFeature.newBuilder().
            setGeometry(avroPoint).
            setAttributes(attributes).
            build();
}
 
开发者ID:mraad,项目名称:AvroToolbox,代码行数:19,代码来源:ExportToAvroTool.java

示例2: write

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
@Override
public void write(
        final Put put,
        final byte[] geomColFam,
        final IGeometry geometry) throws IOException
{
    final Point point = (Point) geometry;

    m_dataFileWriter.create(AvroPoint.getClassSchema(), this);
    final AvroCoord coord = AvroCoord.newBuilder().
            setX(point.getX()).
            setY(point.getY()).
            build();
    m_dataFileWriter.append(AvroPoint.newBuilder().
            setSpatialReference(m_spatialReference).
            setCoord(coord).
            build());
    m_dataFileWriter.close();

    put.add(geomColFam, pointQual, this.toByteArray());

    this.reset();
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:24,代码来源:PointWriterAvro.java

示例3: buildRecord

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
private GenericRecord buildRecord(
        final Schema schema,
        final int wkid,
        final IFields fields,
        final IFeature feature,
        final Point shape) throws IOException
{
    final GenericRecord genericRecord = new GenericData.Record(schema);
    for (final Schema.Field schemaField : schema.getFields())
    {
        final int index = fields.findField(schemaField.name());
        if (index > -1)
        {
            genericRecord.put(schemaField.name(), feature.getValue(index));
        }
    }

    final Schema.Field geometryField = schema.getField("geometry");
    final Schema geometrySchema = geometryField.schema();
    final GenericRecord geometry = new GenericData.Record(geometrySchema);
    genericRecord.put("geometry", geometry);

    final Schema.Field spatialReferenceField = geometrySchema.getField("spatialReference");
    final GenericRecord spatialReference = new GenericData.Record(spatialReferenceField.schema());
    spatialReference.put("wkid", wkid);
    geometry.put("spatialReference", spatialReference);

    final Schema.Field coordField = geometrySchema.getField("coord");
    final GenericRecord coord = new GenericData.Record(coordField.schema());
    coord.put("x", shape.getX());
    coord.put("y", shape.getY());
    geometry.put("coord", coord);

    return genericRecord;
}
 
开发者ID:mraad,项目名称:AvroToolbox,代码行数:36,代码来源:ExportToGenericAvroTool.java

示例4: write

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
@Override
public void write(
        final Put put,
        final byte[] geomColFam,
        final IGeometry geometry) throws IOException
{
    final Point point = (Point) geometry;
    m_stringBuilder.setLength(0);
    m_stringBuilder.append("{\"type\":\"Point\",\"coordinates\":[").
            append(point.getX()).
            append(",").
            append(point.getY()).
            append(")]}");
    put.add(geomColFam, pointQual, Bytes.toBytes(m_stringBuilder.toString()));
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:16,代码来源:PointWriterGeoJSON.java

示例5: write

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
@Override
public void write(
        final Put put,
        final byte[] geomColFam,
        final IGeometry geometry) throws IOException
{
    final Point point = (Point) geometry;
    put.add(geomColFam, Const.X, Bytes.toBytes(point.getX()));
    put.add(geomColFam, Const.Y, Bytes.toBytes(point.getY()));
}
 
开发者ID:mraad,项目名称:HBaseToolbox,代码行数:11,代码来源:PointWriterBytes.java

示例6: createGeometry

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
/**
 * Creates the geometry.
 *
 * @param geometry the geometry
 * @return the json element
 */
public static JsonElement createGeometry(IGeometry geometry) {
    JSONObject esriJsonObject = null;

    try {
        switch (geometry.getGeometryType())
        {
        case esriGeometryType.esriGeometryPoint:
            esriJsonObject = getJSONFromPoint((Point)geometry);
            break;

        case esriGeometryType.esriGeometryMultipoint:
            esriJsonObject = ServerUtilities.getJSONFromMultipoint((Multipoint)geometry);
            break;

        case esriGeometryType.esriGeometryPolyline:
            esriJsonObject = ServerUtilities.getJSONFromPolyline((Polyline)geometry);
            break;

        case esriGeometryType.esriGeometryPolygon:
            esriJsonObject = getJSONFromPolygon((Polygon)geometry);
            break;

        case esriGeometryType.esriGeometryEnvelope:
            esriJsonObject = ServerUtilities.getJSONFromEnvelope((Envelope)geometry);
            break;

        case esriGeometryType.esriGeometryLine:
            esriJsonObject = getJSONFromLine((Line)geometry);
            break;

        default:
            System.err.println(
                    "Only geometries of type Point, Multipoint, Polyline, Polygon and Envelope are supported by this conversion utility. "
                            + geometry.getGeometryType());
            break;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    JsonObject jobj = new Gson().fromJson(esriJsonObject.toString(), JsonObject.class);

    return jobj;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:51,代码来源:CommonObjects.java

示例7: doExport

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
private int doExport(
        final IGPValue hadoopPropValue,
        final IGPValue featureClassValue,
        final IGPValue schemaValue,
        final IGPValue outputValue) throws Exception
{
    int count = 0;
    final IFeatureClass[] featureClasses = new IFeatureClass[]{new IFeatureClassProxy()};
    gpUtilities.decodeFeatureLayer(featureClassValue, featureClasses, null);
    final FeatureClass featureClass = new FeatureClass(featureClasses[0]);
    try
    {
        final int wkid = getWkid(featureClass);

        final Configuration configuration = createConfiguration(hadoopPropValue.getAsText());

        final Schema schema = parseSchema(schemaValue.getAsText(), configuration);

        final Path path = new Path(outputValue.getAsText());
        path.getFileSystem(configuration).delete(path, true);
        final AvroParquetWriter<GenericRecord> writer = new AvroParquetWriter<GenericRecord>(path, schema);
        try
        {
            final IFeatureCursor cursor = featureClass.search(null, false);
            try
            {
                final IFields fields = cursor.getFields();
                IFeature feature = cursor.nextFeature();
                try
                {
                    while (feature != null)
                    {
                        final IGeometry shape = feature.getShape();
                        if (shape instanceof Point)
                        {
                            writer.write(buildRecord(schema, wkid, fields, feature, (Point) shape));
                            count++;
                        }
                        else if (shape instanceof Polyline)
                        {
                            writer.write(buildRecord(schema, wkid, fields, feature, (Polyline) shape));
                            count++;
                        }
                        else if (shape instanceof Polygon)
                        {
                            writer.write(buildRecord(schema, wkid, fields, feature, (Polygon) shape));
                            count++;
                        }
                        feature = cursor.nextFeature();
                    }
                }
                finally
                {
                    Cleaner.release(fields);
                }
            }
            finally
            {
                Cleaner.release(cursor);
            }
        }
        finally
        {
            writer.close();
        }
    }
    finally
    {
        Cleaner.release(featureClass);
    }
    return count;
}
 
开发者ID:mraad,项目名称:AvroToolbox,代码行数:73,代码来源:ExportToAvroParquetTool.java

示例8: onMouseMove

import com.esri.arcgis.geometry.Point; //导入依赖的package包/类
public void onMouseMove(int arg0, int arg1, int arg2, int arg3)
			throws IOException, AutomationException {
		// TODO Auto-generated method stub
		if(!inUse)return;
		boolean firstUse=false;
		if(lineSymbol==null)firstUse=true;
		IPoint movePoint;
		movePoint=activeView.getScreenDisplay().getDisplayTransformation().toMapPoint(arg2,arg3);
		activeView.getScreenDisplay().startDrawing(activeView.getScreenDisplay().getHDC(),(short)-1);
		if(firstUse){
			RgbColor rgbColor=new RgbColor();
			rgbColor.setBlue(223);
			rgbColor.setRed(223);
			rgbColor.setGreen(223);
			
			SimpleLineSymbol sls=new SimpleLineSymbol();
			sls.setColor(rgbColor);
			sls.setWidth(1);
			sls.setROP2(esriRasterOpCode.esriROPXOrPen);
			lineSymbol=sls;
			TextSymbol ts=new TextSymbol();
			ts.setHorizontalAlignment(esriTextHorizontalAlignment.esriTHACenter);
			ts.setVerticalAlignment(esriTextVerticalAlignment.esriTVACenter);
			ts.setSize(12);
			ts.setROP2(esriRasterOpCode.esriROPXOrPen);
			ts.getFont().setName("Arial");
			textSymbol=ts;
			tp=new Point();
		}else{
//			activeView.getScreenDisplay().setSymbol(new ISymbolProxy(textSymbol));
//			activeView.getScreenDisplay().drawText(tp,textSymbol.getText());
//			activeView.getScreenDisplay().setSymbol(new ISymbolProxy(lineSymbol));
//			if(polyline.getLength()>0){
//				activeView.getScreenDisplay().drawPolyline(polyline);
//			}
		}
		Line line=new Line();
		line.putCoords(sp,movePoint);
		double angle=line.getAngle();
		angle=angle*180/3.14159;
		if(angle>90&&angle<180){
			angle+=180;
		}else if(angle<0&&angle>-90){
			angle-=180;
		}else if(angle<-90&&angle>-180){
			angle-=180;
		}else if(angle>180){
			angle-=180;
		}
		double dx,dy,distance;
		dx=movePoint.getX()-sp.getX();
		dy=movePoint.getY()-sp.getY();
		tp.setX(sp.getX()+dx/2);
		tp.setY(sp.getY()+dy/2);
//		textSymbol.setAngle(angle);
		textSymbol.setAngle(0);
		distance=Math.sqrt(dx*dx+dy*dy);
		DecimalFormat format=new DecimalFormat("#.00");
		
		textSymbol.setText(format.format(distance));
//		activeView.getScreenDisplay().setSymbol(new ISymbolProxy(textSymbol));
//		activeView.getScreenDisplay().drawText(tp,textSymbol.getText());
		Polyline pl=new Polyline();
		pl.addSegment(line,null,null);
		polyline=smashLine(activeView.getScreenDisplay(),new ISymbolProxy(textSymbol),tp,pl);
//		activeView.getScreenDisplay().setSymbol(new ISymbolProxy(textSymbol));
//		if(polyline.getLength()>0){
//			activeView.getScreenDisplay().drawPolyline(polyline);
//		}
		activeView.getScreenDisplay().finishDrawing();
		activeView.refresh();
	}
 
开发者ID:vonpower,项目名称:VonRep,代码行数:73,代码来源:Measure.java


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