Class Map2D

java.lang.Object
All Implemented Interfaces:
InterfaceObject, NamedObject, TreeObject, CleanableObject, XMLObject

public class Map2D
extends Map
Maps from a given coordinate system to the screen
Version:
1.0
Author:
Andrew Reid
  • Field Details

    • zoomWidth

      protected double zoomWidth
    • bounds

      public java.awt.Dimension bounds
    • origin

      public org.jogamp.vecmath.Point2f origin
    • min_zoom

      public double min_zoom
    • max_zoom

      public double max_zoom
  • Constructor Details

    • Map2D

      public Map2D()
    • Map2D

      public Map2D​(java.awt.Dimension theBounds, double theZoom, org.jogamp.vecmath.Point2f theOrigin)
  • Method Details

    • getBounds

      public java.awt.Dimension getBounds()
    • getMapBounds

      public Rect2D getMapBounds()
    • getTransform

      public java.awt.geom.AffineTransform getTransform()
      Returns a transform corresponding to this map.
      Returns:
    • setScreenBounds

      public void setScreenBounds​(java.awt.Dimension d)
    • setScreenBounds

      public void setScreenBounds​(int width, int height)
    • setOrigin

      public void setOrigin​(float x, float y)
    • getScreenPoint

      public java.awt.Point getScreenPoint​(org.jogamp.vecmath.Point2f p)
      Maps p from model space to screen space.
      Parameters:
      thisPt -
      Returns:
    • getScreenDist

      public int getScreenDist​(double thisDist)
    • getMapDist

      public float getMapDist​(int thisDist)
    • getMapDist

      public float getMapDist​(double thisDist)
    • getMapPoint

      public org.jogamp.vecmath.Point2f getMapPoint​(java.awt.Point thisPt)
      Get the map coordinate of the screen point
      Parameters:
      thisPt -
      Returns:
    • centerOnPoint

      public void centerOnPoint​(org.jogamp.vecmath.Point2f centerPt)
    • getMapCenterPt

      public org.jogamp.vecmath.Point2f getMapCenterPt()
    • getScreenWidth

      public int getScreenWidth()
    • getScreenBounds

      public java.awt.Rectangle getScreenBounds​(Rect2D thisBounds)
    • zoomToMapWindow

      public void zoomToMapWindow​(Rect2D window)
    • getType

      public int getType()
      Overrides:
      getType in class Map
    • getZoom

      public double getZoom()
      Overrides:
      getZoom in class Map
    • setZoom

      public void setZoom​(double z)
      Overrides:
      setZoom in class Map
    • setZoom

      public void setZoom​(double z, boolean center)
      Sets the zoom; if center = true, maintains the window center point
      Parameters:
      z -
      center -
    • getDTD

      public java.lang.String getDTD()
      Description copied from interface: XMLObject
      Returns the Data Type Declaration (DTD) for this object's XML representation

      See http://en.wikipedia.org/wiki/Document_Type_Definition for a description.

      Returns:
    • getXMLSchema

      public java.lang.String getXMLSchema()
      Description copied from interface: XMLObject
      Returns the XML schema for this object's XML representation

      See http://en.wikipedia.org/wiki/XML_schema.

      Returns:
    • getXML

      public java.lang.String getXML()
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Returns:
    • getXML

      public java.lang.String getXML​(int tab)
      Description copied from interface: XMLObject
      Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Parameters:
      tab - The number of tabs to place before the opening XML wrapper
      Returns:
    • handleXMLElementStart

      public void handleXMLElementStart​(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles the start of an XML element.
      Parameters:
      localName - Local name of the element
      attributes - Set of element attributes
      type - The XMLType of this element
      Throws:
      org.xml.sax.SAXException
    • handleXMLElementEnd

      public void handleXMLElementEnd​(java.lang.String localName) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles the end of an XML element.
      Parameters:
      localName - Local name of the element
      Throws:
      org.xml.sax.SAXException
    • handleXMLString

      public void handleXMLString​(java.lang.String s) throws org.xml.sax.SAXException
      Description copied from interface: XMLObject
      Handles a string within an XML element.
      Parameters:
      s - String to handle
      Throws:
      org.xml.sax.SAXException
    • getLocalName

      public java.lang.String getLocalName()
      Description copied from interface: XMLObject
      Returns the local name associated with this XML object.
      Returns:
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format of XMLFormat.Ascii will be used.
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      options - XMLOutputOptions defining the write parameters
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file, as XMLType.Normal. The default format of XMLFormat.Ascii will be used. The basic contract for this method is that it should not write a newline character at its start or end.
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      progress_bar - Optional progress updater (may be null)
      Throws:
      java.io.IOException
    • writeXML

      public void writeXML​(int tab, java.io.Writer writer) throws java.io.IOException
      Description copied from interface: XMLObject
      Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format of XMLFormat.Ascii will be used.
      Parameters:
      tab - The number of tabs to place before the XML text
      writer - The writer
      Throws:
      java.io.IOException
    • getShortXML

      public java.lang.String getShortXML​(int tab)
      Description copied from interface: XMLObject
      Returns a short XML representation of this object.
      Returns: