Re: [OpenMap Users] Simple jython "version" of openmap application

From: Don Dietrick <dietrick@bbn.com>
Date: Thu Jul 17 2003 - 16:45:32 EDT

Hi Karl,

Very interesting, thanks. I've updated it here to reflect some of the
changes in the 4.6:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
import sys

import java.awt.BorderLayout as BorderLayout
import java.awt.Color as Color
import java.awt.Dimension as Dimension

from java.io import *
import java.util.Properties as Properties

from javax.swing import *
import javax.swing.border.BevelBorder as BevelBorder

import com.bbn.openmap.MapHandler as MapHandler
import com.bbn.openmap.PropertyHandler as PropertyHandler
import com.bbn.openmap.gui.BasicMapPanel as BasicMapPanel
import com.bbn.openmap.gui.OpenMapFrame as OpenMapFrame
import com.bbn.openmap.layer.util.LayerUtils as LayerUtils

class OpenMap:
     def __init__(self,propertiesFile=None):

         self.beanHandler = None

         if propertiesFile == None:
             propertyHandler = PropertyHandler()
         else:
             #leaving out error handling for now
             propertyHandler =
PropertyHandler(LayerUtils.getResourceOrFileOrURL(propertiesFile))

        self.mapPanel = BasicMapPanel(propertyHandler)
        self.mapPanel.getMapHandler().add(OpenMapFrame())
        self.mapPanel.getMapBean().showLayerPalettes()

     def getMapHandler(self):
         if self.beanHandler == None:
             self.beanHandler = MapHandler()
         return self.beanHandler

     def getMapPanel(self):
             return self.mapPanel

if __name__ == '__main__':
     propArg = None
     if sys.argv.length > 2:
         propArg = sys.argv[1]
     OpenMap(propArg)
else:
     pass

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

On Wednesday, July 16, 2003, at 11:06 AM, Lewin, Karl E wrote:

> I'm not sure if anyone is interested in this but I thought I'd send it
> along anyway. It is a rough/simplified translation of openmap.java
> into
> Jython, the java homed version of python.
>
>
> ***********************************************************************
> **
> import sys
>
> import java.awt.BorderLayout as BorderLayout
> import java.awt.Color as Color
> import java.awt.Dimension as Dimension
>
> from java.io import *
> import java.util.Properties as Properties
>
> from javax.swing import *
> import javax.swing.border.BevelBorder as BevelBorder
>
> from com.bbn.openmap import *
> from com.bbn.openmap.proj import *
> import com.bbn.openmap.util.Debug as Debug
> import com.bbn.openmap.util.ArgParser as ArgParser
> import com.bbn.openmap.layer.util.LayerUtils as LayerUtils
>
> class OpenMap:
> def __init__(self,propertiesFile=None):
>
> self.beanHandler = None
>
> if propertiesFile == None:
> propertyHandler = PropertyHandler()
> else:
> #leaving out error handling for now
> propertyHandler =
> PropertyHandler(LayerUtils.getResourceOrFileOrURL(None,propertiesFile))
>
> mapBean = BufferedMapBean()
> mapBean.setBorder(BevelBorder(BevelBorder.LOWERED))
> envWidth =
> Environment.getInteger(Environment.Width,MapBean.DEFAULT_WIDTH)
> envHeight =
> Environment.getInteger(Environment.Height,MapBean.DEFAULT_HEIGHT)
> proj =
> ProjectionFactory.makeProjection(ProjectionFactory.getProjType(Environm
> ent.g
> et(Environment.Projection,Mercator.MercatorName)),
>
> Environment.getFloat(Environment.Latitude,0.0),
>
> Environment.getFloat(Environment.Longitude,0.0),
>
> Environment.getFloat(Environment.Scale,400000000.0),
> envWidth, envHeight)
> mapBean.setProjection(proj)
> mapBean.setPreferredSize(Dimension(envWidth,envHeight))
>
> self.beanHandler = self.getMapHandler()
>
> try:
> self.beanHandler.add(propertyHandler)
> print "here"
> self.beanHandler.add(mapBean)
> print "there"
> propertyHandler.createComponents(self.beanHandler)
> print "everywhere"
> except:
> print "Error"
> mapBean.showLayerPalettes()
>
> def getMapHandler(self):
> if self.beanHandler == None:
> self.beanHandler = MapHandler()
> return self.beanHandler
>
> if __name__ == '__main__':
> OpenMap(sys.argv[1])
> else:
> pass
>
>
>
>
> --
> [To unsubscribe to this list send an email to "majdart@bbn.com"
> with the following text in the BODY of the message "unsubscribe
> openmap-users"]
>
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, BBN Technologies, dietrick@bbn.com
10 Moulton Street, Cambridge, MA 02138
617-873-3031 [fax]-2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Jul 17 16:46:48 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT