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

📄 segmentplaneattributes.java

📁 world wind java sdk 源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                Logging.logger().severe(message);
                throw new IllegalArgumentException(message);
            }

            this.horizontalAlignment = horizontalAlignment;
        }

        public String getVerticalAlignment()
        {
            return this.verticalAlignment;
        }

        public void setVerticalAlignment(String verticalAlignment)
        {
            if (verticalAlignment == null)
            {
                String message = Logging.getMessage("nullValue.VerticalAlignmentIsNull");
                Logging.logger().severe(message);
                throw new IllegalArgumentException(message);
            }

            this.verticalAlignment = verticalAlignment;
        }

        public double getMinActiveDistance()
        {
            return this.minActiveDistance;
        }

        public void setMinActiveDistance(double distance)
        {
            this.minActiveDistance = distance;
        }

        public double getMaxActiveDistance()
        {
            return this.maxActiveDistance;
        }

        public void setMaxActiveDistance(double distance)
        {
            this.maxActiveDistance = distance;
        }

        public Vec4 getOffset()
        {
            return this.offset;
        }

        public void setOffset(Vec4 vec4)
        {
            if (vec4 == null)
            {
                String message = Logging.getMessage("nullValue.Vec4IsNull");
                Logging.logger().severe(message);
                throw new IllegalArgumentException(message);
            }

            this.offset = vec4;
        }

        public String getText(SegmentPlane segmentPlane, Position position, AVList values)
        {
            if (segmentPlane == null)
            {
                String message = Logging.getMessage("nullValue.SegmentPlaneIsNull");
                Logging.logger().severe(message);
                throw new IllegalArgumentException(message);
            }
            if (position == null)
            {
                String message = Logging.getMessage("nullValue.PositionIsNull");
                Logging.logger().severe(message);
                throw new IllegalArgumentException(message);
            }

            StringBuilder sb = new StringBuilder();
            sb.append("Lat ").append(position.getLatitude().toString());
            sb.append("\n");
            sb.append("Lon ").append(position.getLongitude());
            sb.append("\n");
            sb.append("Alt ").append(position.getElevation()).append("m");

            return sb.toString();
        }
    }

    private Map<Object, GeometryAttributes> geometryAttributes;
    private Map<Object, LabelAttributes> labelAttributes;

    public SegmentPlaneAttributes()
    {
        this.geometryAttributes = new HashMap<Object, GeometryAttributes>();
        this.labelAttributes = new HashMap<Object, LabelAttributes>();
    }

    public SegmentPlaneAttributes copy()
    {
        SegmentPlaneAttributes copy = new SegmentPlaneAttributes();

        Map<Object, GeometryAttributes> geometryAttributesMap = new HashMap<Object, GeometryAttributes>();
        for (Map.Entry<Object, GeometryAttributes> entry : this.geometryAttributes.entrySet())
        {
            geometryAttributesMap.put(entry.getKey(), entry.getValue().copy());
        }
        copy.setAllGeometryAttributes(geometryAttributesMap);

        Map<Object, LabelAttributes> labelAttributesMap = new HashMap<Object, LabelAttributes>();
        for (Map.Entry<Object, LabelAttributes> entry : this.labelAttributes.entrySet())
        {
            labelAttributesMap.put(entry.getKey(), entry.getValue().copy());
        }
        copy.setAllLabelAttributes(labelAttributesMap);

        return copy;
    }

    public Map<Object, GeometryAttributes> getAllGeometryAttributes()
    {
        return Collections.unmodifiableMap(this.geometryAttributes);
    }

    public void setAllGeometryAttributes(Map<Object, ? extends GeometryAttributes> map)
    {
        if (map == null)
        {
            String message = Logging.getMessage("nullValue.MapIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.geometryAttributes.clear();
        this.geometryAttributes.putAll(map);
    }

    public Map<Object, LabelAttributes> getAllLabelAttributes()
    {
        return Collections.unmodifiableMap(this.labelAttributes);
    }

    public void setAllLabelAttributes(Map<Object, ? extends LabelAttributes> map)
    {
        if (map == null)
        {
            String message = Logging.getMessage("nullValue.MapIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.labelAttributes.clear();
        this.labelAttributes.putAll(map);
    }

    public GeometryAttributes getGeometryAttributes(Object key)
    {
        if (key == null)
        {
            String message = Logging.getMessage("nullValue.KeyIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        return this.geometryAttributes.get(key);
    }

    public void setGeometryAttributes(Object key, GeometryAttributes attributes)
    {
        if (key == null)
        {
            String message = Logging.getMessage("nullValue.KeyIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        if (attributes == null)
        {
            String message = Logging.getMessage("nullValue.AttributesIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.geometryAttributes.put(key, attributes);
    }

    public LabelAttributes getLabelAttributes(Object key)
    {
        if (key == null)
        {
            String message = Logging.getMessage("nullValue.KeyIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        return this.labelAttributes.get(key);
    }

    public void setLabelAttributes(Object key, LabelAttributes attributes)
    {
        if (key == null)
        {
            String message = Logging.getMessage("nullValue.KeyIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        if (attributes == null)
        {
            String message = Logging.getMessage("nullValue.AttributesIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        this.labelAttributes.put(key, attributes);
    }

    public static void applyGeometryAttributes(DrawContext dc, GeometryAttributes attributes, boolean enableMaterial)
    {
        if (dc == null)
        {
            String message = Logging.getMessage("nullValue.DrawContextIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        if (dc.getGL() == null)
        {
            String message = Logging.getMessage("nullValue.DrawingContextGLIsNull");
            Logging.logger().severe(message);
            throw new IllegalStateException(message);
        }
        if (attributes == null)
        {
            String message = Logging.getMessage("nullValue.AttributesIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        if (!dc.isPickingMode())
        {
            applyMaterial(dc, attributes.getMaterial(), attributes.getOpacity(), enableMaterial);
        }
    }

    public static void applyGeometryAttributesAsLine(DrawContext dc, GeometryAttributes attributes)
    {
        if (dc == null)
        {
            String message = Logging.getMessage("nullValue.DrawContextIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }
        if (dc.getGL() == null)
        {
            String message = Logging.getMessage("nullValue.DrawingContextGLIsNull");
            Logging.logger().severe(message);
            throw new IllegalStateException(message);
        }
        if (attributes == null)
        {
            String message = Logging.getMessage("nullValue.AttributesIsNull");
            Logging.logger().severe(message);
            throw new IllegalArgumentException(message);
        }

        applyLineWidth(dc, attributes.getSize(), attributes.getPicksize());
    }

    protected static void applyMaterial(DrawContext dc, Material material, double opacity, boolean enableMaterial)
    {
        GL gl = dc.getGL();

        if (enableMaterial)
        {
            material.apply(gl, GL.GL_FRONT_AND_BACK, (float) opacity);
        }
        else
        {
            float[] compArray = new float[4];
            material.getDiffuse().getRGBComponents(compArray);
            compArray[3] = (float) opacity;
            gl.glColor4fv(compArray, 0);
        }
    }

    protected static void applyLineWidth(DrawContext dc, double lineWidth, double pickLineWidth)
    {
        GL gl = dc.getGL();

        if (dc.isPickingMode())
        {
            gl.glLineWidth((float) pickLineWidth);
        }
        else
        {
            gl.glLineWidth((float) lineWidth);
        }
    }
}

⌨️ 快捷键说明

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