📄 esrigraphicfactory.java
字号:
((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_Z_ATTRIBUTE, zs); byteTracker.addRead((2 + numPoints) * 8); if (byteTracker.numLeft() > 0) { double minM = iStream.readLEDouble(); double maxM = iStream.readLEDouble(); double[] ms = new double[numPoints]; for (int i = 0; i < numPoints; i++) { ms[i] = iStream.readLEDouble(); } ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MIN_MEASURE_ATTRIBUTE, new Double(minM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MAX_MEASURE_ATTRIBUTE, new Double(maxM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, ms); byteTracker.addRead((2 + numPoints) * 8); } } return multiPart; } protected EsriGraphic createPointMGraphic( BinaryFile shpFile, Object representation, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { double x = shpFile.readDouble(); double y = shpFile.readDouble(); double m = shpFile.readDouble(); byteTracker.addRead(3 * 8); EsriGraphic ret = createPointGraphic(x, y, representation, drawingAttributes); ret.setType(SHAPE_TYPE_POINTM); ((OMGraphic) ret).putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, new Double(m)); return ret; } protected EsriGraphic createPointMGraphic( LittleEndianInputStream iStream, Object representation, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { double x = iStream.readLEDouble(); double y = iStream.readLEDouble(); double m = iStream.readLEDouble(); byteTracker.addRead(3 * 8); EsriGraphic ret = createPointGraphic(x, y, representation, drawingAttributes); ret.setType(SHAPE_TYPE_POINTM); ((OMGraphic) ret).putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, new Double(m)); return ret; } protected EsriGraphic createMultiPointMGraphic( BinaryFile shpFile, Object representation, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { EsriGraphic multiPart = createMultiPointGraphic(shpFile, representation, drawingAttributes, byteTracker); if (multiPart != null && multiPart instanceof EsriGraphicList) { ((EsriGraphicList) multiPart).setType(SHAPE_TYPE_MULTIPOINTM); int numPoints = ((EsriGraphicList) multiPart).size(); if (byteTracker.numLeft() > 0) { double minM = shpFile.readDouble(); double maxM = shpFile.readDouble(); double[] ms = new double[numPoints]; for (int i = 0; i < numPoints; i++) { ms[i] = shpFile.readDouble(); } ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MIN_MEASURE_ATTRIBUTE, new Double(minM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MAX_MEASURE_ATTRIBUTE, new Double(maxM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, ms); byteTracker.addRead((2 + numPoints) * 8); } } return multiPart; } protected EsriGraphic createMultiPointMGraphic( LittleEndianInputStream iStream, Object representation, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { EsriGraphic multiPart = createMultiPointGraphic(iStream, representation, drawingAttributes, byteTracker); if (multiPart != null && multiPart instanceof EsriGraphicList) { ((EsriGraphicList) multiPart).setType(SHAPE_TYPE_MULTIPOINTM); int numPoints = ((EsriGraphicList) multiPart).size(); if (byteTracker.numLeft() > 0) { double minM = iStream.readLEDouble(); double maxM = iStream.readLEDouble(); double[] ms = new double[numPoints]; for (int i = 0; i < numPoints; i++) { ms[i] = iStream.readLEDouble(); } ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MIN_MEASURE_ATTRIBUTE, new Double(minM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MAX_MEASURE_ATTRIBUTE, new Double(maxM)); ((OMGraphic) multiPart).putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, ms); byteTracker.addRead((2 + numPoints) * 8); } } return multiPart; } // ///////// Polygon Shapes protected EsriGraphic createPolygonGraphic( BinaryFile shpFile, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyGraphic(shpFile, SHAPE_TYPE_POLYGON, drawingAttributes, byteTracker); } protected EsriGraphic createPolygonGraphic( LittleEndianInputStream iStream, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyGraphic(iStream, SHAPE_TYPE_POLYGON, drawingAttributes, byteTracker); } protected EsriGraphic createPolylineGraphic( BinaryFile shpFile, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyGraphic(shpFile, SHAPE_TYPE_POLYLINE, drawingAttributes, byteTracker); } protected EsriGraphic createPolylineGraphic( LittleEndianInputStream iStream, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyGraphic(iStream, SHAPE_TYPE_POLYLINE, drawingAttributes, byteTracker); } protected EsriGraphic createPolyGraphic( BinaryFile shpFile, int shapeType, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { EsriGraphic ret = null; // Skip reading the bounding box, 4 doubles shpFile.skipBytes(4 * 8); byteTracker.addRead(4 * 8); int numParts = shpFile.readInteger(); int numPoints = shpFile.readInteger(); byteTracker.addRead(2 * 4); if (numParts > 0) { ret = getPolys(shpFile, numParts, numPoints, shapeType, drawingAttributes, byteTracker); } return ret; } protected EsriGraphic createPolyGraphic( LittleEndianInputStream iStream, int shapeType, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { EsriGraphic ret = null; // Skip reading the bounding box, 4 doubles iStream.skipBytes(4 * 8); byteTracker.addRead(4 * 8); int numParts = iStream.readLEInt(); int numPoints = iStream.readLEInt(); byteTracker.addRead(2 * 4); if (numParts > 0) { ret = getPolys(iStream, numParts, numPoints, shapeType, drawingAttributes, byteTracker); } return ret; } protected EsriGraphic createPolygonZGraphic( BinaryFile shpFile, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyZGraphic(shpFile, SHAPE_TYPE_POLYGONZ, drawingAttributes, byteTracker); } protected EsriGraphic createPolygonZGraphic( LittleEndianInputStream iStream, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyZGraphic(iStream, SHAPE_TYPE_POLYGONZ, drawingAttributes, byteTracker); } protected EsriGraphic createPolylineZGraphic( BinaryFile shpFile, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyZGraphic(shpFile, SHAPE_TYPE_POLYLINEZ, drawingAttributes, byteTracker); } protected EsriGraphic createPolylineZGraphic( LittleEndianInputStream iStream, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { return createPolyZGraphic(iStream, SHAPE_TYPE_POLYLINEZ, drawingAttributes, byteTracker); } protected EsriGraphic createPolyZGraphic( BinaryFile shpFile, int shapeType, DrawingAttributes drawingAttributes, ReadByteTracker byteTracker) throws IOException, FormatException { EsriGraphic ret = null; // Skip reading the bounding box, 4 doubles shpFile.skipBytes(4 * 8); byteTracker.addRead(4 * 8); int numParts = shpFile.readInteger(); int numPoints = shpFile.readInteger(); byteTracker.addRead(2 * 4); if (numParts > 0) { ret = getPolys(shpFile, numParts, numPoints, shapeType, drawingAttributes, byteTracker); } double minZ = shpFile.readDouble(); double maxZ = shpFile.readDouble(); double[] zs = new double[numPoints]; for (int i = 0; i < numPoints; i++) { zs[i] = shpFile.readDouble(); } OMGraphic omg = (OMGraphic) ret; omg.putAttribute(ShapeConstants.SHAPE_MIN_Z_ATTRIBUTE, new Double(minZ)); omg.putAttribute(ShapeConstants.SHAPE_MAX_Z_ATTRIBUTE, new Double(maxZ)); omg.putAttribute(ShapeConstants.SHAPE_Z_ATTRIBUTE, zs); byteTracker.addRead((2 + numPoints) * 8); if (byteTracker.numLeft() > 0) { double minM = shpFile.readDouble(); double maxM = shpFile.readDouble(); double[] ms = new double[numPoints]; for (int i = 0; i < numPoints; i++) { ms[i] = shpFile.readDouble(); } omg.putAttribute(ShapeConstants.SHAPE_MIN_MEASURE_ATTRIBUTE, new Double(minM)); omg.putAttribute(ShapeConstants.SHAPE_MAX_MEASURE_ATTRIBUTE, new Double(maxM)); omg.putAttribute(ShapeConstants.SHAPE_MEASURE_ATTRIBUTE, ms); byteTracker.addRead((2 + numPoints) * 8); } return ret; } protected EsriGraphic createPolyZGraphic( LittleEndianInputStream iStream, int shapeType, DrawingAttributes drawingAttributes,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -