Package gov.nasa.worldwind.geom

Examples of gov.nasa.worldwind.geom.Vec4


    protected void determineLabelLocation(DrawContext dc)
    {
        // Reuse the current label location if its inside the view frustum and the label is completely visible when
        // placed there. Otherwise we find a new location that maximizes the label's visible area and is closest to the
        // current location.
        Vec4 lastPoint = this.getLabelPoint(dc);
        if (lastPoint != null && dc.getView().getFrustumInModelCoordinates().contains(lastPoint))
        {
            // Project the current location's model point into screen coordinates, and place the label at the
            // projected point. We do this to measure the label's visible area when placed at that point.
            Vec4 screenPoint = dc.getView().project(lastPoint);
            this.setLabelLocation(dc, screenPoint);

            // If the label is completely visible, just reuse its current location.
            if (this.isLabelCompletelyVisible(dc))
                return;
        }

        this.labelLocationIndex = -1;

        if (this.getLocations() == null)
            return;

        double maxArea = 0;
        double minDistance = Double.MAX_VALUE;
        int locationIndex = -1;

        for (LatLon ll : this.getLocations())
        {
            ++locationIndex;

            if (ll == null)
                continue;

            // Compute the specified location's point in model coordinates. Ignore locations who's model coordinate
            // point cannot be computed for any reason, or are outside the view frustum.
            Vec4 point = this.computePoint(dc, ll);
            if (point == null || !dc.getView().getFrustumInModelCoordinates().contains(point))
                continue;

            // Project the specified location's model point into screen coordinates, and place the label at the
            // projected point. We do this to measure the label's visible area when placed at that point.
            Vec4 screenPoint = dc.getView().project(point);
            this.setLabelLocation(dc, screenPoint);

            // Find the location that maximizes the label's visible area.
            double area = this.getLabelVisibleArea(dc);
            if (maxArea < area)
View Full Code Here


    {
        if (this.getAnnotation() == null)
            return;

        // Get the label's model point from the location iterable.
        Vec4 point = this.getLabelPoint(dc);
        if (point == null)
            return;

        // Project the label's model point into screen coordinates, place the annotation at the projected point then
        // draw the annotation.
        Vec4 screenPoint = dc.getView().project(point);
        this.setLabelLocation(dc, screenPoint);
        this.getAnnotation().render(dc);
    }
View Full Code Here

TOP

Related Classes of gov.nasa.worldwind.geom.Vec4

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.