本文整理汇总了Java中org.gwtopenmaps.openlayers.client.util.JSObject.getPropertyAsString方法的典型用法代码示例。如果您正苦于以下问题:Java JSObject.getPropertyAsString方法的具体用法?Java JSObject.getPropertyAsString怎么用?Java JSObject.getPropertyAsString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gwtopenmaps.openlayers.client.util.JSObject
的用法示例。
在下文中一共展示了JSObject.getPropertyAsString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColorStyleData
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入方法依赖的package包/类
private void getColorStyleData(Style style) {
if(style != null) {
JSObject jsStyle = style.getJSObject();
String fillColor = jsStyle.getPropertyAsString("userFillColor");
String strokeColor = jsStyle.getPropertyAsString("userStrokeColor");
int thickness = (int) Math.floor(style.getStrokeWidth());
/**
* Si estamos en modo de estilo por feature, hay que coger el color
* de referencia de las propiedades userFillColor y userStrokeColor,
* puesto que los features afectados están seleccionados y por tanto
* tienen asignado el color de relleno y linea del modo selección
*/
getFill().setNormalColor(fillColor != null ? fillColor : style.getFillColor());
getFill().setOpacity(style.getFillOpacity());
getLine().setNormalColor(strokeColor != null ? strokeColor : style.getStrokeColor());
getLine().setThickness(thickness);
}
}
示例2: getLabelStyleData
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入方法依赖的package包/类
private void getLabelStyleData(Style style, VectorLayer layer) {
if(style != null) {
JSObject jsStyle = style.getJSObject();
boolean enabled = jsStyle.getPropertyAsString("userAttributeLabel") != null
&& !jsStyle.getPropertyAsString("userAttributeLabel").isEmpty();
if(enabled) {
getLabel().setAttribute(layer.getAttribute(
jsStyle.getPropertyAsString("userAttributeLabel")));
getLabel().setFontSize(getFontSize(jsStyle));
getLabel().setBoldStyle(isBoldFont(jsStyle));
getLabel().setBackgroundColor(jsStyle.getPropertyAsString("labelOutlineColor"));
}
}
}
示例3: getFontSize
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入方法依赖的package包/类
private Integer getFontSize(JSObject style) {
String fontSize = style.getPropertyAsString("fontSize");
if(fontSize != null && !fontSize.isEmpty()) {
fontSize = fontSize.substring(0, fontSize.lastIndexOf("px"));
return Integer.parseInt(fontSize);
}
return LabelStyle.DEFAULT_FONT_SIZE;
}
示例4: isBoldFont
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入方法依赖的package包/类
private boolean isBoldFont(JSObject style) {
String fontWeight = style.getPropertyAsString("fontWeight");
if(fontWeight == null || fontWeight.isEmpty()) {
fontWeight = "regular";
}
return fontWeight.equalsIgnoreCase("bold");
}
示例5: getStyleDef
import org.gwtopenmaps.openlayers.client.util.JSObject; //导入方法依赖的package包/类
public VectorFeatureStyleDef getStyleDef(JSObject styleObject) {
VectorFeatureStyleDef def = new VectorFeatureStyleDef();
if (styleObject.hasProperty(LeafletStyle.FILL_COLOR_NAME)) {
String fillColor = styleObject.getPropertyAsString(LeafletStyle.FILL_COLOR_NAME);
def.getFill().setNormalColor(fillColor);
}
if (styleObject.hasProperty(LeafletStyle.FILL_OPACITY_NAME)) {
Double fillOpacity = styleObject.getPropertyAsDouble(LeafletStyle.FILL_OPACITY_NAME);
def.getFill().setOpacity(fillOpacity);
}
if (styleObject.hasProperty(LeafletStyle.STROKE_COLOR_NAME)) {
String strokeColor = styleObject.getPropertyAsString(LeafletStyle.STROKE_COLOR_NAME);
def.getLine().setNormalColor(strokeColor);
}
if (styleObject.hasProperty(LeafletStyle.STROKE_WIDTH_NAME)) {
Double strokeWidth = styleObject.getPropertyAsDouble(LeafletStyle.STROKE_WIDTH_NAME);
def.getLine().setThickness(strokeWidth.intValue());
}
JSObject iconObject = styleObject.getProperty(LeafletStyle.ICON_NAME);
if (iconObject != null) {
if (iconObject.hasProperty(LeafletStyle.ICON_URL_NAME)) {
String iconUrl = iconObject.getPropertyAsString(LeafletStyle.ICON_URL_NAME);
def.getPoint().setExternalGraphic(iconUrl);
}
if (iconObject.hasProperty(LeafletStyle.ICON_SIZE_NAME)) {
JsArrayInteger iconSize = iconObject.getProperty(LeafletStyle.ICON_SIZE_NAME).cast();
int iconWidth = iconSize.get(0);
int iconHeight = iconSize.get(1);
def.getPoint().setGraphicWidth(iconWidth);
def.getPoint().setGraphicHeight(iconHeight);
}
}
return def;
}