All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ctreber.acearth.scandot.DotGeneratorLines Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

The newest version!
package com.ctreber.acearth.scandot;

import com.ctreber.acearth.projection.Projection;
import com.ctreber.acearth.util.Coordinate;
import com.ctreber.acearth.util.Point2D;
import com.ctreber.acearth.util.Point3D;

/**
 * 

Generate latitude and longitude grid as dots. * *

Refactored 08.11.2002 * *

© 2002 Christian Treber, [email protected] * @author Christian Treber, [email protected] * */ public class DotGeneratorLines extends ScanDotGenerator { private Projection fProjection; private int fLineDivider; private int fPointDivider; private static final double PI = Math.PI; private static final double TWOPI = 2 * PI; private static final double HALFPI = PI / 2; public DotGeneratorLines(Projection pProjection, int pLineDevider, int pPointDivider) { fProjection = pProjection; fLineDivider = pLineDevider; fPointDivider = pPointDivider; } /** *

Paint grid. */ public void generateScanDots() { double lLonStep = TWOPI / (fLineDivider * 4); double lLatStep = PI / (fLineDivider * 2 * fPointDivider); for(double lLon = -PI; lLon <= PI; lLon += lLonStep) { for(double lLat = -HALFPI; lLat <= HALFPI; lLat += lLatStep) { transformAndAddDot(new Coordinate(lLat, lLon)); } } lLatStep = TWOPI / (fLineDivider * 4); lLonStep = PI / (fLineDivider * 2 * fPointDivider); for(double lLat = -HALFPI; lLat <= HALFPI; lLat += lLatStep) { for(double lLon = -PI; lLon <= PI; lLon += lLonStep) { transformAndAddDot(new Coordinate(lLat, lLon)); } } } private void transformAndAddDot(Coordinate pPos) { final Point3D lPointRotated = fProjection.rotate(pPos.getPoint3DRads()); if(fProjection.isVisible(lPointRotated)) { Point2D lPoint = fProjection.finalize(fProjection.project2D(lPointRotated)); if(fProjection.isWithinImage(lPoint)) { fDots.add(new ScanDot(ScanDot.DotTypeGrid, lPoint)); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy