⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 esrigraphicfactory.java

📁 OpenMap是一个基于JavaBeansTM的开发工具包。利用OpenMap你就能够快速构建用于访问legacy数据库的应用程序与applets。OpenMap提供了允许用户查看和操作地理空间信息的
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                                             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);        }        double minZ = iStream.readLEDouble();        double maxZ = iStream.readLEDouble();        double[] zs = new double[numPoints];        for (int i = 0; i < numPoints; i++) {            zs[i] = iStream.readLEDouble();        }        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 = iStream.readLEDouble();            double maxM = iStream.readLEDouble();            double[] ms = new double[numPoints];            for (int i = 0; i < numPoints; i++) {                ms[i] = iStream.readLEDouble();            }            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 createPolygonMGraphic(                                                BinaryFile shpFile,                                                DrawingAttributes drawingAttributes,                                                ReadByteTracker byteTracker)            throws IOException, FormatException {        return createPolyZGraphic(shpFile,                SHAPE_TYPE_POLYGONM,                drawingAttributes,                byteTracker);    }    protected EsriGraphic createPolygonMGraphic(                                                LittleEndianInputStream iStream,                                                DrawingAttributes drawingAttributes,                                                ReadByteTracker byteTracker)            throws IOException, FormatException {        return createPolyZGraphic(iStream,                SHAPE_TYPE_POLYGONM,                drawingAttributes,                byteTracker);    }    protected EsriGraphic createPolylineMGraphic(                                                 BinaryFile shpFile,                                                 DrawingAttributes drawingAttributes,                                                 ReadByteTracker byteTracker)            throws IOException, FormatException {        return createPolyZGraphic(shpFile,                SHAPE_TYPE_POLYLINEM,                drawingAttributes,                byteTracker);    }    protected EsriGraphic createPolylineMGraphic(                                                 LittleEndianInputStream iStream,                                                 DrawingAttributes drawingAttributes,                                                 ReadByteTracker byteTracker)            throws IOException, FormatException {        return createPolyZGraphic(iStream,                SHAPE_TYPE_POLYLINEM,                drawingAttributes,                byteTracker);    }    protected EsriGraphic createPolyMGraphic(                                             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);        }        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 omg = (OMGraphic) ret;            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 createPolyMGraphic(                                             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);        }        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 omg = (OMGraphic) ret;            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 getPolys(BinaryFile shpFile, int numParts,                                   int numPoints, int shapeType,                                   DrawingAttributes drawingAttributes,                                   ReadByteTracker byteTracker)            throws IOException, FormatException {        EsriGraphic ret = null;        if (numParts > 1) {            ret = createEsriGraphicList(shapeType);            if (ret instanceof EsriGraphicList) {                ((EsriGraphicList) ret).setVague(true);            }        }        int[] parts = new int[numParts];        for (int i = 0; i < numParts; i++) {            parts[i] = shpFile.readInteger();        }        byteTracker.addRead(numParts * 4);        int origin = parts[0];        int length = 0;        float[] coords;        for (int i = 1; i < numParts; i++) {            int nextOrigin = parts[i];            length = nextOrigin - origin;            coords = getFloatCoords(shpFile,                    length,                    isPolygon(shapeType),                    dataTransformation,                    byteTracker);            EsriGraphic omp = createEsriPoly(shapeType,                    coords,                    lineType,                    drawingAttributes);            ((EsriGraphicList) ret).add((OMGraphic) omp);            origin = nextOrigin;        }        length = numPoints - origin;        coords = getFloatCoords(shpFile,                length,                isPolygon(shapeType),                dataTransformation,                byteTracker);        EsriGraphic omp = createEsriPoly(shapeType,                coords,                lineType,                drawingAttributes);        if (ret != null) {            ((EsriGraphicList) ret).add((OMGraphic) omp);        } else {            ret = (EsriGraphic) omp;        }        return ret;    }    protected EsriGraphic getPolys(LittleEndianInputStream iStream,                                   int numParts, int numPoints, int shapeType,                                   DrawingAttributes drawingAttributes,                                   ReadByteTracker byteTracker)            throws IOException, FormatException {        EsriGraphic ret = null;        if (numParts > 1) {            ret = createEsriGraphicList(shapeType);            if (ret instanceof EsriGraphicList) {                ((EsriGraphicList) ret).setVague(true);            }        }        int[] parts = new int[numParts];        for (int i = 0; i < numParts; i++) {            parts[i] = iStream.readLEInt();        }        byteTracker.addRead(numParts * 4);        int origin = parts[0];        int length = 0;        float[] coords;        for (int i = 1; i < numParts; i++) {            int nextOrigin = parts[i];            length = nextOrigin - origin;            coords = getFloatCoords(iStream,                    length,                    isPolygon(shapeType),                    dataTransformation,                    byteTracker);            EsriGraphic omp = createEsriPoly(shapeType,                    coords,                    lineType,                    drawingAttributes);            ((EsriGraphicList) ret).add((OMGraphic) omp);            origin = nextOrigin;        }        length = numPoints - origin;        coords = getFloatCoords(iStream,                length,                isPolygon(shapeType),                dataTransformation,                byteTracker);        EsriGraphic omp = createEsriPoly(shapeType,                coords,                lineType,                drawingAttributes);        if (ret != null) {            ((EsriGraphicList) ret).add((OMGraphic) omp);        } else {            ret = (EsriGraphic) omp;        }        return ret;    }    protected static float[] getFloatCoords(BinaryFile shpFile, int length,                                            boolean isPolygon,                                            GeoCoordTransformation dataTrans,                                            ReadByteTracker bitTracker)            throws IOException, FormatException {        float[] coords = new float[isPolygon ? length * 2 + 2 : length * 2];        int j = 0;        // Create the llp here and reuse it for coordinate transformations.        LatLonPoint llp = null;        if (dataTrans != null) {            llp = new LatLonPoint();        }        for (j = 0; j < length; j++) {            double x = shpFile.readDouble();            double y = shpFile.readDouble();            bitTracker.addRead(2 * 8);            if (dataTrans != null) {                dataTrans.inverse(x, y, llp);                x = llp.radlon_;                y = llp.radlat_;            } else {                x = ProjMath.degToRad(x);                y = ProjMath.degToRad(y);            }            coords[j * 2] = (float) y;            coords[j * 2 + 1] = (float) x;        }        if (isPolygon) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -