Exemplo n.º 1
0
def getViewManagers(viewId=None):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = mcv.getVMManager().getViewManagers()
        if not viewId:
            return viewManagers
            
        if viewId.startswith('name:'):
            viewId = viewId.replace('name:', '')
            
        goodOnes = []
        for (index, vm) in enumerate(viewManagers):
            if viewId.startswith('#'):
                if index == int(viewId[1:]):
                    goodOnes.append(vm)
                continue
            if viewId.startswith('class:'):
                if StringUtil.stringMatch(vm.getClass().getName(), viewId[6:], True, True):
                    goodOnes.append(vm)
                continue
                
            name = vm.getName()
            if not name:
                name = ''
            if StringUtil.stringMatch(name, viewId, True, True):
                goodOnes.append(vm)
                
        return goodOnes
Exemplo n.º 2
0
def getViewManagers(viewId=None):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = mcv.getVMManager().getViewManagers()
        if not viewId:
            return viewManagers

        if viewId.startswith('name:'):
            viewId = viewId.replace('name:', '')

        goodOnes = []
        for (index, vm) in enumerate(viewManagers):
            if viewId.startswith('#'):
                if index == int(viewId[1:]):
                    goodOnes.append(vm)
                continue
            if viewId.startswith('class:'):
                if StringUtil.stringMatch(vm.getClass().getName(), viewId[6:],
                                          True, True):
                    goodOnes.append(vm)
                continue

            name = vm.getName()
            if not name:
                name = ''
            if StringUtil.stringMatch(name, viewId, True, True):
                goodOnes.append(vm)

        return goodOnes
Exemplo n.º 3
0
def removeAllDisplays():
    """
    <removedisplays> Remove all displays
    <removedisplays 
        display="display id to remove" >
    This removes all current displays. If there is the display attribute set then it removes that display. (See below).
    <removedisplays/>
    """
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllLayers(False)
Exemplo n.º 4
0
def removeAllDisplays():
    """
    <removedisplays> Remove all displays
    <removedisplays 
        display="display id to remove" >
    This removes all current displays. If there is the display attribute set then it removes that display. (See below).
    <removedisplays/>
    """
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllLayers(False)
Exemplo n.º 5
0
def findDisplayControl(displayId):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for control in mcv.getDisplayControls():
            if displayId.startswith('class:'):
                if StringUtil.stringMatch(control.getClass().getName(), displayId[6:], True, True):
                    return control
            if control.getId():
                if StringUtil.stringMatch(control.getId(), displayId, True, True):
                    return control
    return None
Exemplo n.º 6
0
def findDisplayControl(displayId):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for control in mcv.getDisplayControls():
            if displayId.startswith('class:'):
                if StringUtil.stringMatch(control.getClass().getName(),
                                          displayId[6:], True, True):
                    return control
            if control.getId():
                if StringUtil.stringMatch(control.getId(), displayId, True,
                                          True):
                    return control
    return None
Exemplo n.º 7
0
def centerDisplay(viewId, useProjection=False):
    control = findDisplayControl(id)
    if not control:
        raise IllegalArgumentException('Could not find display: %s' % (id))
        
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers(viewId)
        if useProjection and control.getDataProjection():
            mapProjection = control.getDataProjection()
            mcv.getVMManager().center(mapProjection, viewManagers)
        elif control.getDisplayCenter():
            centerPoint = Util.makeEarthLocation(control.getDisplayCenter())
            mcv.getVMManager().center(centerPoint, viewManagers)
Exemplo n.º 8
0
def centerDisplay(viewId, useProjection=False):
    control = findDisplayControl(id)
    if not control:
        raise IllegalArgumentException('Could not find display: %s' % (id))

    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers(viewId)
        if useProjection and control.getDataProjection():
            mapProjection = control.getDataProjection()
            mcv.getVMManager().center(mapProjection, viewManagers)
        elif control.getDisplayCenter():
            centerPoint = Util.makeEarthLocation(control.getDisplayCenter())
            mcv.getVMManager().center(centerPoint, viewManagers)
Exemplo n.º 9
0
        jars['visad'] + '/visad/python',
        jars['idv'],
        jars['idv'] + '/ucar/unidata/idv/resources/python',
        jars['mcidasv'],
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python',
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python/utilities',
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python/linearcombo',
    ]
    
for jythonpath in _mcvinit_jythonpaths():
    if not jythonpath in sys.path:
        sys.path.append(jythonpath)
        
# this is intentionally the first IDV/McV thing imported
from edu.wisc.ssec.mcidasv import McIDASV
_mcv = McIDASV.getStaticMcv()

# make sys.argv look as if the user ran "jython file.py arg1 ... argN"
from edu.wisc.ssec.mcidasv import ArgumentManager
argManager = _mcv.getArgsManager()
if argManager.hasJythonArguments():
    sys.argv = [argManager.getJythonScript()] + argManager.getJythonArguments()
    
# need to get some IDV-specifc init done
from ucar.unidata.idv.ui import ImageGenerator
islInterpreter = ImageGenerator(_mcv)

from edu.wisc.ssec.mcidasv.data.hydra import Statistics

# TODO(jon): is this really what we want!?
from visad.python.JPythonMethods import *
Exemplo n.º 10
0
def centerOnRectangle(north, south, west, east):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers()
        projRect = ProjectionRect(west, north, east, south)
        mcv.getVMManager().center(projRec, viewManagers)
Exemplo n.º 11
0
def centerOnLatLon(latitude, longitude):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers()
        earthLoc = Util.makeEarthLocation(latitude, longitude)
        mcv.getVMManager().center(earthLoc, viewManagers)
Exemplo n.º 12
0
def removeAllData():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllData(False)
Exemplo n.º 13
0
def reload():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for source in mcv.getDataSources():
            source.reloadData()
Exemplo n.º 14
0
def removeAllData():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllData(False)
Exemplo n.º 15
0
def reload():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for source in mcv.getDataSources():
            source.reloadData()
Exemplo n.º 16
0
def centerOnLatLon(latitude, longitude):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers =  getViewManagers()
        earthLoc = Util.makeEarthLocation(latitude, longitude)
        mcv.getVMManager().center(earthLoc, viewManagers)
Exemplo n.º 17
0
        jars['visad'] + '/visad/python',
        jars['idv'],
        jars['idv'] + '/ucar/unidata/idv/resources/python',
        jars['mcidasv'],
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python',
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python/utilities',
        jars['mcidasv'] + '/edu/wisc/ssec/mcidasv/resources/python/linearcombo',
    ]
    
for jythonpath in _mcvinit_jythonpaths():
    if not jythonpath in sys.path:
        sys.path.append(jythonpath)
        
# this is intentionally the first IDV/McV thing imported
from edu.wisc.ssec.mcidasv import McIDASV
_mcv = McIDASV.getStaticMcv()

# make sys.argv look as if the user ran "jython file.py arg1 ... argN"
from edu.wisc.ssec.mcidasv import ArgumentManager
argManager = _mcv.getArgsManager()
if argManager.hasJythonArguments():
    sys.argv = [argManager.getJythonScript()] + argManager.getJythonArguments()
    
# need to get some IDV-specifc init done
from ucar.unidata.idv.ui import ImageGenerator
islInterpreter = ImageGenerator(_mcv)

from edu.wisc.ssec.mcidasv.data.hydra import Statistics

# TODO(jon): is this really what we want!?
from visad.python.JPythonMethods import *
Exemplo n.º 18
0
def centerOnRectangle(north, south, west, east):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers()
        projRect = ProjectionRect(west, north, east, south)
        mcv.getVMManager().center(projRec, viewManagers)