Exemple #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
Exemple #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
Exemple #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)
Exemple #4
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
Exemple #5
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)
Exemple #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
Exemple #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)
Exemple #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)
Exemple #9
0
def reload():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for source in mcv.getDataSources():
            source.reloadData()
Exemple #10
0
def removeAllData():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllData(False)
Exemple #11
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)
Exemple #12
0
def centerOnLatLon(latitude, longitude):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers =  getViewManagers()
        earthLoc = Util.makeEarthLocation(latitude, longitude)
        mcv.getVMManager().center(earthLoc, viewManagers)
Exemple #13
0
def reload():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        for source in mcv.getDataSources():
            source.reloadData()
Exemple #14
0
def removeAllData():
    mcv = McIDASV.getStaticMcv()
    if mcv:
        mcv.removeAllData(False)
Exemple #15
0
def centerOnLatLon(latitude, longitude):
    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers()
        earthLoc = Util.makeEarthLocation(latitude, longitude)
        mcv.getVMManager().center(earthLoc, viewManagers)
Exemple #16
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 *
Exemple #17
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)
Exemple #18
0
def pauseUntilDone():
    mcv = McIDASV.importStaticMcv()
    if mcv:
        mcv.waitUntilDisplaysAreDone()
Exemple #19
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 *
Exemple #20
0
def pauseUntilDone():
    mcv = McIDASV.importStaticMcv()
    if mcv:
        mcv.waitUntilDisplaysAreDone()