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
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
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)
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)
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
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
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)
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)
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 *
def centerOnRectangle(north, south, west, east): mcv = McIDASV.getStaticMcv() if mcv: viewManagers = getViewManagers() projRect = ProjectionRect(west, north, east, south) mcv.getVMManager().center(projRec, viewManagers)
def centerOnLatLon(latitude, longitude): mcv = McIDASV.getStaticMcv() if mcv: viewManagers = getViewManagers() earthLoc = Util.makeEarthLocation(latitude, longitude) mcv.getVMManager().center(earthLoc, viewManagers)
def removeAllData(): mcv = McIDASV.getStaticMcv() if mcv: mcv.removeAllData(False)
def reload(): mcv = McIDASV.getStaticMcv() if mcv: for source in mcv.getDataSources(): source.reloadData()
def removeAllData(): mcv = McIDASV.getStaticMcv() if mcv: mcv.removeAllData(False)
def reload(): mcv = McIDASV.getStaticMcv() if mcv: for source in mcv.getDataSources(): source.reloadData()
def centerOnLatLon(latitude, longitude): mcv = McIDASV.getStaticMcv() if mcv: viewManagers = getViewManagers() earthLoc = Util.makeEarthLocation(latitude, longitude) mcv.getVMManager().center(earthLoc, viewManagers)
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 *
def centerOnRectangle(north, south, west, east): mcv = McIDASV.getStaticMcv() if mcv: viewManagers = getViewManagers() projRect = ProjectionRect(west, north, east, south) mcv.getVMManager().center(projRec, viewManagers)