Package nav.position

Examples of nav.position.Position


        distanceMap = initDistanceMap(new ConcurrentHashMap<Double, TableEntry>(3600));
        Thread coverageCalculatorThread = new Thread(new Runnable() {

            public void run() {
                List<Double> tmpList;
                Position pos;
                while (true) {
                    try {
                        coveragePerimeter = new ArrayList<Position>(3600);
                        coveragePerimeter.add(location);
                        calculateCoveragePerimiter();
                        tmpList = new ArrayList<Double>(3600);
                        // Add any non-null positions to the geo-position list so
                        // that they can later form the points for the coverage polygon
                        for (Double key : distanceMap.keySet()) {
                            if (distanceMap.get(key).getPosition() != null) {
                                tmpList.add(key);
                            }
                        }
                        // Sort the positions according to their appearance from 0 to 360 degrees
                        Collections.sort(tmpList);
                        for (Double key : tmpList) {
                            pos = new Position(distanceMap.get(key).getPosition().getLatitude(),
                                    distanceMap.get(key).getPosition().getLongitude());
                            coveragePerimeter.add(pos);
                        }
                        pos = new Position(getLocation().getLatitude(),
                                getLocation().getLongitude());

                        coveragePerimeter.add(pos);
                        // Sleep two seconds
                        pos = null;
View Full Code Here


    private void calculateCoveragePerimiter() {
        NavCalculator nav = new NavCalculator();
        AISMsg msg;
        // Calculate the distances from each target to the base station
        double distance;
        Position targetPosition;
        double key;
        for (Target t : getTargets()) {
            if (t.getType() == Target.TARGET_BASESTN) {
                continue;
            }
            targetPosition = t.getPosition();
            if (targetPosition == null) {
                if (targetPosition == null) {
                    msg = (t.getLatestDynamicMsg() == null
                            ? t.getLatestMessage()
                            : t.getLatestDynamicMsg());
                    if (msg.getPosition() != null) {
                        targetPosition = msg.getPosition();
                    } else {
                        continue;
                    }
                }
            }
            // Filter: Delete targets that have badly configured positions
            if (targetPosition.getLatitude() <= 0 || targetPosition.getLongitude() <= -50) {
                targetsMap.remove(t.getMMSI());
                continue;
            }

            // Calculate the vessel's distance from the AIS receiver
View Full Code Here

            int r, g, b;
            r = rand.nextInt(255);
            g = rand.nextInt(255);
            b = rand.nextInt(255);

            Position pos = new Position(latitude, longitude);
            DataSource src = new DataSource(pos, rxID, ipAddress, port, true,
                    new Color(r, g, b, 50), targetsMap);

            sources.add(src);
            src.start();
View Full Code Here

     * @since 1.0
     */
    public void addSource(String ipAddress, int port, String rxID,
            double latitude, double longitude, Color color) {
        try {
            Position pos = new Position(latitude, longitude);
            DataSource src = new DataSource(pos, rxID, ipAddress, port, true, color, targetsMap);
            sources.add(src);
            coordinates.put(rxID, pos);
            SettingsStore.getInstance().addDataSource(src);
        } catch (InvalidPositionException e) {
View Full Code Here

//        if (heading >= 0 && heading <= 360) {
//            safetyBubble.setHeading(heading);
//        } else if (course >= 0 && course <= 360) {
//            safetyBubble.setHeading(course);
//        }
        Position pos = getPosition();
        String txt = generateLabelText();
        if (visibleTarget == null) {
            visibleTarget = new SurfaceIcon(getIconURL(), LatLon.fromDegrees(pos.getLatitude(), pos.getLongitude()));
            TargetLayer.getInstance().addRenderable(visibleTarget);
            label = new GlobeAnnotation(txt, new gov.nasa.worldwind.geom.Position(LatLon.fromDegrees(pos.getLatitude(), pos.getLongitude()), 0.1));
            TargetTextLayer.getInstance().addAnnotation(label);
        } else {
            visibleTarget.setImageSource(getIconURL());
            visibleTarget.setLocation(LatLon.fromDegrees(pos.getLatitude(), pos.getLongitude()));
            label.setText(txt);
            label.setPosition(new gov.nasa.worldwind.geom.Position(LatLon.fromDegrees(pos.getLatitude(), pos.getLongitude()), 0.1));
        }
        visibleTarget.setHeading(Angle.fromDegrees(getCourse()));
    }
View Full Code Here

     *
     * @return              A <code>Position</code> representing the target's centre.
     * @since 1.0
     */
    public Position getCentroid() {
        Position centre = null;
        int direction = 0;
        int heading = getHeading();
        if (heading < 0 || heading > 360) {
            heading = getCourse();
        }
View Full Code Here

    }

    public Position getSternPosition() {
        // Calculate the bow's lat/long position if heading/course
        // are available
        Position sternPosition = null;
        int heading = getHeading();
        int course = getCourse();
        if (heading < 0 || heading > 360) {
            if (course >= 0 && course <= 360) {
                heading = course;
View Full Code Here

     * @since 1.0
     */
    public Position getBowPosition() {
        // Calculate the bow's lat/long position if heading/course
        // are available
        Position bowPosition = null;
        int heading = getHeading();
        int course = getCourse();
        if (heading < 0 || heading > 360) {
            if (course >= 0 && course <= 360) {
                bowPosition = NavCalculator.computePosition(getCentroid(),
View Full Code Here

     * @since 1.0
     */
    public Position getPortPosition() {
        // Calculate the port's lat/long position if heading/course
        // are available
        Position portPosition = null;
        int heading = getHeading();
        int course = getCourse();
        if (heading < 0) {
            if (course >= 0) {
                heading = course;
View Full Code Here

     * @since 1.0
     */
    public Position getStarboardPosition() {
        // Calculate the port's lat/long position if heading/course
        // are available
        Position starboardPosition = null;
        int heading = getHeading();
        int course = getCourse();
        if (heading < 0) {
            if (course >= 0 && course != 511) {
                heading = course;
View Full Code Here

TOP

Related Classes of nav.position.Position

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.