📄 displaysettingstask.java
字号:
package com.esri.solutions.jitk.web.tasks.serviceprops;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import javax.faces.model.SelectItem;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import com.esri.adf.web.data.GISResource;
import com.esri.adf.web.data.MapFunctionality;
import com.esri.adf.web.data.TileFunctionality;
import com.esri.adf.web.data.TocNode;
import com.esri.adf.web.data.TocNodeContent;
import com.esri.adf.web.data.TocResourceContent;
import com.esri.adf.web.data.WebMap;
import com.esri.adf.web.data.graphics.GraphicsResource;
import com.esri.adf.web.faces.event.TaskEvent;
import com.esri.adf.web.faces.event.TocEvent;
import com.esri.solutions.jitk.common.contextmenus.ContextMenuItemTaskManager;
import com.esri.solutions.jitk.common.contextmenus.IContextMenuItemTask;
import com.esri.solutions.jitk.common.contextmenus.IResourceContextMenuItem;
import com.esri.solutions.jitk.common.resources.TextResources;
import com.esri.solutions.jitk.web.data.IBCTMapFunctionality;
import com.esri.solutions.jitk.web.data.image.TintParameters;
import com.esri.solutions.jitk.web.tasks.RenderControlledTask;
import com.esri.solutions.jitk.web.wfs.data.WFSMapResource;
/**
* Task to view and alter the display settings of a GIS Resources.
* The display settings include brightness, contrast, tint, and
* transparency. The user will be presented drop-down boxes with
* the ability to choose predefined settings for brightness, contrast,
* and tint.
*/
public class DisplaySettingsTask extends RenderControlledTask implements IContextMenuItemTask, IResourceContextMenuItem {
private static final long serialVersionUID = 1143448215773211437L;
private static final Logger LOG = LogManager.getLogger(DisplaySettingsTask.class);
/**
* Desired brightness value.
*/
private int m_brightness = 0;
/**
* Desired contrast value.
*/
private int m_contrast = 1;
/**
* Desired Tint Red value.
*/
private int m_tintRed = 0 ;
/**
* Desired Tint Green value.
*/
private int m_tintGreen = 0;
/**
* Desired Tint Blue value.
*/
private int m_tintBlue = 0;
/**
* Desired Transparency value.
*/
private double m_transparency = 1.0;
/**
* Contains values for a drop-down list of predefined
* brightness selections.
*/
private final Map<Byte, String> m_brightnessValues;
/**
* Contains values for a drop-down list of predefined
* contrast selections.
*/
private final Map<Byte, String> m_contrastValues;
/**
* Contains values for a drop-down list of predefined
* Tint Red selections.
*/
private final Map<Byte, String> m_tintRedValues;
/**
* Contains values for a drop-down list of predefined
* Tint Green selections.
*/
private final Map<Byte, String> m_tintGreenValues;
/**
* Contains values for a drop-down list of predefined
* Tint Blue selections.
*/
private final Map<Byte, String> m_tintBlueValues;
/**
* Contains values for a drop-down list of predefined
* Transparency selections.
*/
private final Map<Double, String> m_transparencyValues;
/**
* Reference to the Context Menu Item Task Manager. Will be used
* to open the Task UI when the Context Menu Item is selected.
*/
private ContextMenuItemTaskManager m_mgr;
/**
* Reference to the GIS Resource in which to apply the display
* settings.
*/
private GISResource m_res;
/**
* ID of the Task. Needed for the implementation of
* {@link IContextMenuItemTask}.
*/
private String m_taskId;
/**
* Reference to the Task Info for this task.
*/
private DisplaySettingsTaskInfo m_taskInfo;
/**
* Constructs a new <code>DisplaySettingsTask</code>.
*/
public DisplaySettingsTask () {
m_taskInfo = new DisplaySettingsTaskInfo();
setTaskInfo(m_taskInfo);
m_brightnessValues = new LinkedHashMap<Byte,String>();
m_contrastValues = new LinkedHashMap<Byte,String>();
m_tintRedValues = new LinkedHashMap<Byte,String>();
m_tintGreenValues = new LinkedHashMap<Byte,String>();
m_tintBlueValues = new LinkedHashMap<Byte,String>();
m_transparencyValues = new LinkedHashMap<Double,String>();
}
/**
* Returns the Alias of the GIS Resource that the display settings
* should be applied to.
*
* @return Alias of GIS Resource.
*/
public String getGisResourceName () {
if (m_res != null) {
return m_res.getAlias();
}
return "";
}
/**
* Returns the ID of the GIS Resource that the display settings
* should be applied to.
*
* @return ID of GIS Resource.
*/
public String getGisResourceId() {
String id = this._context.getResourceId(m_res);
return id;
}
/**
* Sets the ID of the GIS Resource that the display settings
* should be applied to. CURRENTLY NOT IMPLEMENTED.
*
* @param id ID of GIS Resource.
*/
public void setGisResourceId (String id) {
}
/**
* Returns the name of the WebContext object. This will be used
* to build a URL to access the current map image for the Preview.
*
* @return Name of WebContext.
*/
public String getWebContextName () {
return this._context.getName();
}
/**
* Returns the collection of predefined Brightness values
* for the drop-down. The collection contains a set of mappings
* between actual value and display value.
*
* @return Predefined Brightness values.
*/
public Map<Byte,String> getBrightnessValues () {
return m_brightnessValues;
}
/**
* Sets the collection of predefined Brightness values
* for the drop-down. The collection should contain a set
* of mappings between actual value and display value.
*
* @param values Predefined Brightness values.
*/
public void setBrightnessValues (Map<Byte,String> values) {
if (values != null) {
m_brightnessValues.clear();
m_brightnessValues.putAll(values);
}
}
/**
* Returns the collection of predefined Contrast values
* for the drop-down. The collection contains a set of mappings
* between actual value and display value.
*
* @return Predefined Contrast values.
*/
public Map<Byte,String> getContrastValues () {
return m_contrastValues;
}
/**
* Sets the collection of predefined Contrast values
* for the drop-down. The collection should contain a set
* of mappings between actual value and display value.
*
* @param values Predefined Contrast values.
*/
public void setContrastValues (Map<Byte,String> values) {
if (values != null) {
m_contrastValues.clear();
m_contrastValues.putAll(values);
}
}
/**
* Returns the collection of predefined Tint Red values
* for the drop-down. The collection contains a set of mappings
* between actual value and display value.
*
* @return Predefined Tint Red values.
*/
public Map<Byte,String> getTintRedValues () {
return m_tintRedValues;
}
/**
* Sets the collection of predefined Tint Red values
* for the drop-down. The collection should contain a set
* of mappings between actual value and display value.
*
* @param values Predefined Tint Red values.
*/
public void setTintRedValues (Map<Byte,String> values) {
if (values != null) {
m_tintRedValues.clear();
m_tintRedValues.putAll(values);
}
}
/**
* Returns the collection of predefined Tint Green values
* for the drop-down. The collection contains a set of mappings
* between actual value and display value.
*
* @return Predefined Tint Green values.
*/
public Map<Byte,String> getTintGreenValues () {
return m_tintGreenValues;
}
/**
* Sets the collection of predefined Tint Green values
* for the drop-down. The collection should contain a set
* of mappings between actual value and display value.
*
* @param values Predefined Tint Green values.
*/
public void setTintGreenValues (Map<Byte,String> values) {
if (values != null) {
m_tintGreenValues.clear();
m_tintGreenValues.putAll(values);
}
}
/**
* Returns the collection of predefined Tint Blue values
* for the drop-down. The collection contains a set of mappings
* between actual value and display value.
*
* @return Predefined Tint Blue values.
*/
public Map<Byte,String> getTintBlueValues() {
return m_tintBlueValues;
}
/**
* Sets the collection of predefined Tint Blue values
* for the drop-down. The collection should contain a set
* of mappings between actual value and display value.
*
* @param values Predefined Tint Blue values.
*/
public void setTintBlueValues (Map<Byte,String> values) {
if (values != null) {
m_tintBlueValues.clear();
m_tintBlueValues.putAll(values);
}
}
/**
* Returns the ID of the Task. This must match the ID given to the
* Task tag in the JSP page. The ID is needed so that the Context
* Menu Item Task Manager knows which Task Window to open.
*
* @return ID of Task.
*/
public String getTaskId() {
return m_taskId;
}
/**
* Sets the Context Menu Item Task Manager within this object. The
* Context Menu Item Task Manager is needed in order to set the
* Task Window to open in the renderer.
*
* @param mgr Context Menu Item Task Manager object.
*/
public void setContextMenuItemTaskManager(ContextMenuItemTaskManager mgr) {
m_mgr = mgr;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.common.contextmenus.IContextMenuItem#createSelectItem()
*/
public SelectItem createSelectItem() {
SelectItem item = new SelectItem();
item.setLabel(TextResources.getResourceString("displaySettingsTask.ui.label.contextmenu"));
item.setValue("displaySettings");
return item;
}
/*
* (non-Javadoc)
* @see com.esri.solutions.jitk.common.contextmenus.IContextMenuItem#handleContextMenuEvent(com.esri.adf.web.faces.event.TocEvent)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -