本文整理汇总了Java中gov.nasa.worldwind.layers.Layer.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Layer.setEnabled方法的具体用法?Java Layer.setEnabled怎么用?Java Layer.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.layers.Layer
的用法示例。
在下文中一共展示了Layer.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeLayerVisible
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
public synchronized void makeLayerVisible(Layer newLayer, boolean ignoreLayer) {
if (newLayer == null) return;
if (ignoreLayer)
layerManager.addIgnoredLayer(newLayer);
LayerList ll = wwModel.getLayers();
newLayer.setEnabled(true);
if (newLayer.getOpacity() < .3)
newLayer.setOpacity(1);
ll.remove(newLayer);
ll.add(ll.size(), newLayer);
if (!ignoreLayer)
setLayerManagerVisible(true);
}
示例2: addLayers
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
private void addLayers() {
for(int i = 0;i<Constants.layers.length;i++){
File xml = new File(getExternalCacheDir()+"/"+Constants.URLWORLD+Constants.layers[i]+"/",Constants.layers[i]+".xml");
if(xml.exists()){
Layer lyr=createLayer(xml.getAbsolutePath());
if(null!=lyr){
lyr.setName(Constants.layers[i]);
lyr.setNetworkRetrievalEnabled(false);
if(!layersEnabled[i]){
lyr.setEnabled(false);
}
wwd.getModel().getLayers().addIfAbsent(lyr);
}
}else{
removeLayer(Constants.layers[i]);
}
}
}
示例3: setEnabled
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
for (Layer layer : layers)
layer.setEnabled(enabled);
}
示例4: updateComponent
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
protected void updateComponent(Object component, boolean enable)
{
if (component instanceof Layer)
{
Layer layer = (Layer) component;
LayerList layers = this.wwd.getModel().getLayers();
layer.setEnabled(enable);
if (enable)
{
if (!layers.contains(layer))
{
ApplicationTemplate.insertBeforePlacenames(this.wwd, layer);
this.firePropertyChange("LayersPanelUpdated", null, layer);
}
}
else
{
layers.remove(layer);
this.firePropertyChange("LayersPanelUpdated", layer, null);
}
}
else if (component instanceof ElevationModel)
{
ElevationModel model = (ElevationModel) component;
CompoundElevationModel compoundModel =
(CompoundElevationModel) this.wwd.getModel().getGlobe().getElevationModel();
if (enable)
{
if (!compoundModel.getElevationModels().contains(model))
compoundModel.addElevationModel(model);
}
}
}
示例5: actionPerformed
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
editor.switchToMapTab();
Layer worldMapLayer = editor.getMapPanel().getWwd()
.getModel().getLayers()
.getLayerByName(Logging.getMessage("layers.Earth.WorldMapLayer.Name"));
worldMapLayer.setEnabled(!worldMapLayer.isEnabled());
App.prefs.setBooleanPref(PrefKey.MAP_WORLDMAP_ENABLED, worldMapLayer.isEnabled());
}
示例6: insertBeforeCompass
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
/**
* Insert the layer into the layer list just before the compass.
*
* @param wwd
* @param newWWLayer
* @return
*/
private static TVIMap3Layer insertBeforeCompass(final WorldWindow wwd, final TVIMap3Layer newUILayer) {
/*
* update WW model
*/
int compassPosition = 0;
final LayerList wwLayers = wwd.getModel().getLayers();
for (final Layer wwLayer : wwLayers) {
if (wwLayer instanceof CompassLayer) {
compassPosition = wwLayers.indexOf(wwLayer);
}
}
final Layer newWWLayer = newUILayer.wwLayer;
wwLayers.add(compassPosition, newWWLayer);
// update ww layer visibility
newWWLayer.setEnabled(newUILayer.isLayerVisible);
/*
* update UI model
*/
final TVIMap3Layer insertedUILayer = insertBeforeCompass_10(_uiRootItem, newUILayer);
return insertedUILayer;
}
示例7: insertBeforePlaceNames
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
/**
* Insert the layer into the layer list just before the placenames.
*
* @param wwd
* @param newWWLayer
* @return
*/
private static TVIMap3Layer insertBeforePlaceNames(final WorldWindow wwd, final TVIMap3Layer newUILayer) {
/*
* update WW model
*/
int compassPosition = 0;
final LayerList wwLayers = wwd.getModel().getLayers();
for (final Layer wwLayer : wwLayers) {
if (wwLayer instanceof PlaceNameLayer) {
compassPosition = wwLayers.indexOf(wwLayer);
}
}
final Layer newWWLayer = newUILayer.wwLayer;
wwLayers.add(compassPosition, newWWLayer);
// update ww layer visibility
newWWLayer.setEnabled(newUILayer.isLayerVisible);
/*
* update UI model
*/
final TVIMap3Layer insertedUILayer = insertBeforePlaceNames_10(_uiRootItem, newUILayer);
return insertedUILayer;
}
示例8: setLayerVisible_TourTrack
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
/**
* @param tviLayer
* @param isLayerVisible
* @param isUpdateViewer
* @param isUpdateTooltip
*/
private void setLayerVisible_TourTrack( final TVIMap3Layer tviLayer,
final boolean isLayerVisible,
final boolean isUpdateViewer,
final boolean isUpdateTooltip) {
// update model
tviLayer.isLayerVisible = isLayerVisible;
final Layer wwLayer = tviLayer.wwLayer;
// update ww layer
wwLayer.setEnabled(isLayerVisible);
// add/remove layer listener
tviLayer.fireCheckStateListener();
// redraw map
Map3Manager.redrawMap();
// update tooltip
_propToolTip.setLayerVisibility(tviLayer, isUpdateTooltip);
// update viewer
if (isUpdateViewer) {
_layerViewer.setChecked(tviLayer, isLayerVisible);
}
// check/uncheck actions in the map view
Map3Manager.enableMap3Actions();
}
示例9: setEnableLayer
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
protected void setEnableLayer(String layerName, boolean enable) {
for(Layer lyr : wwd.getModel().getLayers()){
if(null!=lyr){
if(lyr.getName().equals(layerName)){
lyr.setEnabled(enable);
}
}
}
}
示例10: actionPerformed
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
editor.switchToMapTab();
Layer compasslayer = editor.getMapPanel().getWwd()
.getModel().getLayers()
.getLayerByName(Logging.getMessage("layers.CompassLayer.Name"));
compasslayer.setEnabled(!compasslayer.isEnabled());
App.prefs.setBooleanPref(PrefKey.MAP_COMPASS_ENABLED, compasslayer.isEnabled());
}
示例11: actionPerformed
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
editor.switchToMapTab();
Layer utmGraticuleLayer = editor.getMapPanel().getWwd()
.getModel().getLayers()
.getLayerByName(Logging.getMessage("layers.Earth.UTMGraticule.Name"));
utmGraticuleLayer.setEnabled(!utmGraticuleLayer.isEnabled());
App.prefs.setBooleanPref(PrefKey.MAP_UTMGRATICULE_ENABLED, utmGraticuleLayer.isEnabled());
//App.prefs.setBooleanPref(PrefKey.MAP_CONTROLS_ENABLED, utmGraticuleLayer.isEnabled());
}
示例12: selected
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
/**
* <code>SelectListener</code> implementation.
*
* @param event the current <code>SelectEvent</code>
*/
@Override
public void selected(SelectEvent event) {
//System.out.println("event.getEventAction(): " + event.getEventAction());
final ScreenAnnotation annotation = getAnnotation();
if (event.hasObjects() && event.getTopObject() == annotation) {
boolean update = false;
if (event.getEventAction().equals(SelectEvent.ROLLOVER)
|| event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
// Highlight annotation
if (!annotation.getAttributes().isHighlighted()) {
annotation.getAttributes().setHighlighted(true);
update = true;
}
// Check for text or url
final PickedObject po = event.getTopPickedObject();
if (po.getValue(AVKey.URL) != null) {
// Set cursor hand on hyperlinks
((Component) this.wwd).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
int i = Integer.parseInt((String) po.getValue(AVKey.URL));
// Select current hyperlink
if (getSelectedIndex() != i) {
setSelectedIndex(i);
update = true;
}
// Enable/disable layer on left click
if (event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
final LayerList layers = getValidLayers();
if (i >= 0 && i < layers.size()) {
final Layer layer = layers.get(i);
final boolean enable = !layer.isEnabled();
layer.setEnabled(enable);
updateVirtualEarthLayers(layer, enable);
update = true;
}
}
} else {
// Unselect if not on an hyperlink
if (getSelectedIndex() != -1) {
setSelectedIndex(-1);
update = true;
}
// Set cursor
if (this.isComponentDragEnabled())
((Component) this.wwd).setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
else
((Component) this.wwd).setCursor(Cursor.getDefaultCursor());
}
}
if (event.getEventAction().equals(SelectEvent.DRAG)
|| event.getEventAction().equals(SelectEvent.DRAG_END)) {
// Handle dragging
if (this.isComponentDragEnabled() || this.isLayerDragEnabled()) {
final boolean wasDraggingLayer = this.draggingLayer;
this.drag(event);
// Update list if dragging a layer, otherwise just redraw the world window
if (this.draggingLayer || wasDraggingLayer)
update = true;
else
this.wwd.redraw();
}
}
// Redraw annotation if needed
if (update)
this.update();
} else if (event.getEventAction().equals(SelectEvent.ROLLOVER) && annotation.getAttributes().isHighlighted()) {
// de-highlight annotation
annotation.getAttributes().setHighlighted(false);
((Component) this.wwd).setCursor(Cursor.getDefaultCursor());
this.update();
}
}
示例13: initialize
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
private void initialize(final JPanel mainPane) {
final WWView toolView = this;
final SwingWorker worker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
// Create the WorldWindow.
try {
createWWPanel(null, includeStatusBar, flatWorld, true);
// Put the pieces together.
mainPane.add(wwjPanel, BorderLayout.CENTER);
final LayerList layerList = getWwd().getModel().getLayers();
final MSVirtualEarthLayer virtualEarthLayerA = new MSVirtualEarthLayer(MSVirtualEarthLayer.LAYER_AERIAL);
virtualEarthLayerA.setName("MS Bing Aerial");
layerList.add(virtualEarthLayerA);
final WWLayerDescriptor[] wwLayerDescriptors = WWLayerRegistry.getInstance().getWWLayerDescriptors();
for (WWLayerDescriptor layerDescriptor : wwLayerDescriptors) {
if (layerDescriptor.showInWorldMapToolView()) {
final WWLayer wwLayer = layerDescriptor.createWWLayer();
layerList.add(wwLayer);
wwLayer.setOpacity(1.0);
wwLayer.setPickEnabled(false);
}
}
final Layer placeNameLayer = layerList.getLayerByName("Place Names");
placeNameLayer.setEnabled(true);
SnapApp.getDefault().getProductManager().addListener(new WWProductManagerListener(toolView));
SnapApp.getDefault().getSelectionSupport(ProductNode.class).addHandler(new SelectionSupport.Handler<ProductNode>() {
@Override
public void selectionChange(@NullAllowed ProductNode oldValue, @NullAllowed ProductNode newValue) {
if (newValue != null) {
setSelectedProduct(newValue.getProduct());
} else {
setSelectedProduct(null);
}
}
});
setProducts(SnapApp.getDefault().getProductManager().getProducts());
setSelectedProduct(SnapApp.getDefault().getSelectedProduct(VIEW));
} catch (Throwable e) {
SnapApp.getDefault().handleError("Unable to initialize WWWorldMapToolView: " + e.getMessage(), e);
}
return null;
}
};
worker.execute();
}
示例14: actionPerformed
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
editor.switchToMapTab();
Layer scalebarlayer = editor.getMapPanel().getWwd()
.getModel().getLayers()
.getLayerByName(Logging.getMessage("layers.Earth.ScalebarLayer.Name"));
scalebarlayer.setEnabled(!scalebarlayer.isEnabled());
App.prefs.setBooleanPref(PrefKey.MAP_SCALEBAR_ENABLED, scalebarlayer.isEnabled());
}
示例15: actionPerformed
import gov.nasa.worldwind.layers.Layer; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
editor.switchToMapTab();
Layer countryBoundaries = editor.getMapPanel().getWwd()
.getModel().getLayers()
.getLayerByName("Political Boundaries");
countryBoundaries.setEnabled(!countryBoundaries.isEnabled());
App.prefs.setBooleanPref(PrefKey.MAP_COUNTRYBOUNDARY_ENABLED, countryBoundaries.isEnabled());
}