当前位置: 首页>>代码示例>>Java>>正文


Java UserStyleInfo类代码示例

本文整理汇总了Java中org.geomajas.sld.UserStyleInfo的典型用法代码示例。如果您正苦于以下问题:Java UserStyleInfo类的具体用法?Java UserStyleInfo怎么用?Java UserStyleInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserStyleInfo类属于org.geomajas.sld包,在下文中一共展示了UserStyleInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SimpleRulesData

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
public SimpleRulesData(String ruleName, int width, int height) throws JiBXException {
	this.width = width;
	this.height = height;
	IBindingFactory bfact = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
	IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
	Object object = uctx.unmarshalDocument(
			getClass().getResourceAsStream("/org/geomajas/testdata/sld/simple_rules.sld"), null);
	StyledLayerDescriptorInfo sld = (StyledLayerDescriptorInfo) object;
	NamedLayerInfo namedLayerInfo = sld.getChoiceList().get(0).getNamedLayer();
	UserStyleInfo userStyleInfo = namedLayerInfo.getChoiceList().get(0).getUserStyle();
	FeatureTypeStyleInfo featureTypeStyleInfo = userStyleInfo.getFeatureTypeStyleList().get(0);
	for (RuleInfo rule : featureTypeStyleInfo.getRuleList()) {
		if (ruleName.equals(rule.getName())) {
			ruleInfo = rule;
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:18,代码来源:LegendGraphicServiceTest.java

示例2: testUserStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
@Test
public void testUserStyle() {
	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext();
	context.setId("test");
	context.setDisplayName("test");
	context.setConfigLocation(
			"/org/geomajas/spring/geomajasContext.xml "+
			"/org/geomajas/internal/configuration/layerDefaultStyle.xml ");
	context.refresh();
	VectorLayer layerDefaultStyle = (VectorLayer)context.getBean("layerDefaultStyle");
	List<NamedStyleInfo> styles = layerDefaultStyle.getLayerInfo().getNamedStyleInfos();
	Assert.assertEquals(1, styles.size());
	NamedStyleInfo defaultStyle = styles.get(0);
	UserStyleInfo userStyle = defaultStyle.getUserStyle();
	List<RuleInfo> rules = userStyle.getFeatureTypeStyleList().get(0).getRuleList();
	Assert.assertEquals(1, rules.size());
	Assert.assertEquals(null, rules.get(0).getName());
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:19,代码来源:ConfigurationDtoPostProcessorVectorLayerTest.java

示例3: render

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
/**
 * Render the legend. This triggers a complete redraw.
 */
public void render() {
	removeMembers(getMembers());
	// Then go over all layers, to draw styles:
	for (Layer<?> layer : mapModel.getLayers()) {
		if (staticLegend || layer.isShowing()) {
			// Go over every truly visible layer:
			if (layer instanceof VectorLayer) {
				ClientVectorLayerInfo layerInfo = ((VectorLayer) layer).getLayerInfo();

				// For vector layer; loop over the style definitions:
				UserStyleInfo userStyle = layerInfo.getNamedStyleInfo().getUserStyle();
				FeatureTypeStyleInfo info = userStyle.getFeatureTypeStyleList().get(0);
				for (int i = 0; i < info.getRuleList().size(); i++) {
					RuleInfo rule = info.getRuleList().get(i);
					// use title if present, name if not
					String title = (rule.getTitle() != null ? rule.getTitle() : rule.getName());
					// fall back to style name
					if (title == null) {
						title = layerInfo.getNamedStyleInfo().getName();
					}
					addVector((VectorLayer) layer, i, title);
				}
			} else if (layer instanceof RasterLayer) {
				addRaster((RasterLayer) layer);
			}
		}
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:32,代码来源:Legend.java

示例4: createStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
/**
 * Create a style with a single rule.
 * 
 * @param rule rule
 * @return the style
 */
public static UserStyleInfo createStyle(RuleInfo rule) {
	UserStyleInfo userStyleInfo = new UserStyleInfo();
	FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo();
	fts.getRuleList().add(rule);
	userStyleInfo.getFeatureTypeStyleList().add(fts);
	return userStyleInfo;
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt2,代码行数:14,代码来源:StyleUtil.java

示例5: createStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
/**
 * Create a style with a single rule.
 * 
 * @param rule
 * @return the style
 */
public static UserStyleInfo createStyle(RuleInfo rule) {
	UserStyleInfo userStyleInfo = new UserStyleInfo();
	FeatureTypeStyleInfo fts = new FeatureTypeStyleInfo();
	fts.getRuleList().add(rule);
	userStyleInfo.getFeatureTypeStyleList().add(fts);
	return userStyleInfo;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:14,代码来源:StyleUtil.java

示例6: createPolygonStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
private UserStyleInfo createPolygonStyle() throws LayerException {
	FeatureStyleInfo style = new FeatureStyleInfo();
	style.setFillColor("#D2691E");
	style.setFillOpacity(0.5f);
	style.setStrokeColor("#D2691E");
	style.setStrokeOpacity(1f);
	style.setStrokeWidth(3);
	style.setLayerType(LayerType.POLYGON);
	NamedStyleInfo ns = new NamedStyleInfo();
	ns.getFeatureStyles().add(style);
	ns.applyDefaults();
	return styleConverterService.convert(ns, GeometryDirectLayer.DEFAULT_GEOMETRY_NAME);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:14,代码来源:GeometryDirectLayerTest.java

示例7: convert

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
@Override
public Style convert(UserStyleInfo userStyleInfo) throws LayerException {
	IBindingFactory bindingFactory;
	try {
		// create a dummy SLD root
		StyledLayerDescriptorInfo sld = new StyledLayerDescriptorInfo();
		sld.setVersion(SLD_VERSION);
		StyledLayerDescriptorInfo.ChoiceInfo choice = new StyledLayerDescriptorInfo.ChoiceInfo();
		NamedLayerInfo namedLayerInfo = new NamedLayerInfo();
		namedLayerInfo.setName(DUMMY_NAMED_LAYER);
		NamedLayerInfo.ChoiceInfo userChoice = new NamedLayerInfo.ChoiceInfo();
		userChoice.setUserStyle(userStyleInfo);
		namedLayerInfo.getChoiceList().add(userChoice);
		choice.setNamedLayer(namedLayerInfo);
		sld.getChoiceList().add(choice);

		// force through Geotools parser
		bindingFactory = BindingDirectory.getFactory(StyledLayerDescriptorInfo.class);
		IMarshallingContext marshallingContext = bindingFactory.createMarshallingContext();
		StringWriter sw = new StringWriter();
		marshallingContext.setOutput(sw);
		marshallingContext.marshalDocument(sld);

		SLDParser parser = new SLDParser(styleFactory, filterService.getFilterFactory());
		parser.setOnLineResourceLocator(new ResourceServiceBasedLocator());
		parser.setInput(new StringReader(sw.toString()));

		Style[] styles = parser.readXML();
		if (styles.length != 0) {
			return styles[0];
		} else {
			throw new LayerException(ExceptionCode.INVALID_USER_STYLE, userStyleInfo.getName());
		}
	} catch (Exception e) {
		throw new LayerException(e, ExceptionCode.INVALID_USER_STYLE, userStyleInfo.getName());
	}
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:38,代码来源:StyleConverterServiceImpl.java

示例8: getGraphics

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
/**
 * @param layerId
 *            the layer id
 * @param styleName
 *            the style name
 * @param format
 *            the image format ('png','jpg','gif')
 * @param width
 *            the graphic's width
 * @param height
 *            the graphic's height
 * @param scale
 *            the scale denominator (not supported yet)
 * @return the model and view
 * @throws GeomajasException
 *             when a style or rule does not exist or is not renderable
 */
private ModelAndView getGraphics(String layerId, String styleName, String format, Integer width, Integer height,
		Double scale) throws GeomajasException {
	ModelAndView mav = new ModelAndView();
	mav.setViewName(LEGENDGRAPHIC_VIEW_NAME);

	if (styleName != null) {
		NamedStyleInfo namedStyle = styleService.retrieveStyle(layerId, styleName);
		if (namedStyle != null) {
			UserStyleInfo userStyle = namedStyle.getUserStyle();
			List<LegendGraphicMetadata> allLegendMetaData = new ArrayList<LegendGraphicMetadata>(userStyle
					.getFeatureTypeStyleList().size());
			for (RuleInfo ruleInfo : userStyle.getFeatureTypeStyleList().get(0).getRuleList()) {
				DefaultLegendGraphicMetadata legendMetadata = new DefaultLegendGraphicMetadata();
				legendMetadata.setLayerId(layerId);
				if (width != null) {
					legendMetadata.setWidth(width);
				}
				if (height != null) {
					legendMetadata.setHeight(height);
				}
				if (scale != null) {
					legendMetadata.setScale(scale);
				}
				if (styleName != null) {
					legendMetadata.setUserStyle(userStyle);
				}
				legendMetadata.setRuleInfo(ruleInfo);
				allLegendMetaData.add(legendMetadata);
			}
			mav.addObject(LegendGraphicView.IMAGE_FORMAT_KEY, format == null ? "png" : format);
			mav.addObject(LegendGraphicView.IMAGE_KEY, legendService.getLegendGraphics(allLegendMetaData));
		}
	}
	return mav;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:53,代码来源:LegendGraphicController.java

示例9: getGraphic

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
/**
 * @param layerId
 *            the layer id
 * @param styleName
 *            the style name
 * @param ruleIndex
 *            the rule index
 * @param format
 *            the image format ('png','jpg','gif')
 * @param width
 *            the graphic's width
 * @param height
 *            the graphic's height
 * @param scale
 *            the scale denominator (not supported yet)
 * @return the model and view
 * @throws GeomajasException
 *             when a style or rule does not exist or is not renderable
 */
private ModelAndView getGraphic(String layerId, String styleName, Integer ruleIndex, String format, Integer width,
		Integer height, Double scale) throws GeomajasException {
	ModelAndView mav = new ModelAndView();
	mav.setViewName(LEGENDGRAPHIC_VIEW_NAME);
	DefaultLegendGraphicMetadata legendMetadata = new DefaultLegendGraphicMetadata();
	legendMetadata.setLayerId(layerId);
	if (width != null) {
		legendMetadata.setWidth(width);
	}
	if (height != null) {
		legendMetadata.setHeight(height);
	}
	if (scale != null) {
		legendMetadata.setScale(scale);
	}
	if (styleName != null) {
		NamedStyleInfo namedStyle = styleService.retrieveStyle(layerId, styleName);
		if (namedStyle != null) {
			UserStyleInfo userStyle = namedStyle.getUserStyle();
			if (ruleIndex != null) {
				FeatureTypeStyleInfo featureTypeStyle = userStyle.getFeatureTypeStyleList().get(0);
				if (ruleIndex < 0 || featureTypeStyle.getRuleList().size() <= ruleIndex) {
					throw new GeomajasException(ExceptionCode.RULE_NOT_FOUND, ruleIndex, styleName);
				} else {
					legendMetadata.setRuleInfo(featureTypeStyle.getRuleList().get(ruleIndex));
				}
			} else {
				legendMetadata.setUserStyle(userStyle);
			}
		}
	}

	mav.addObject(LegendGraphicView.IMAGE_FORMAT_KEY, format == null ? "png" : format);
	mav.addObject(LegendGraphicView.IMAGE_KEY, legendService.getLegendGraphic(legendMetadata));
	return mav;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:56,代码来源:LegendGraphicController.java

示例10: VectorLegendListGrid

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
public VectorLegendListGrid(VectorLayer layer) {
	super();
	setWidth100();
	setHeight(24); // Min height
	setCanEdit(false);
	setShowSelectedStyle(false);
	setShowRollOver(false);
	setShowHeader(false);
	setShowAllRecords(true);
	setBodyOverflow(Overflow.VISIBLE);
	setOverflow(Overflow.VISIBLE);
	setLeaveScrollbarGap(false);
	setWrapCells(true);
	setFixedRecordHeights(false);
	setImageSize(ICONSIZE);

	String name = layer.getLayerInfo().getNamedStyleInfo().getName();
	UrlBuilder url = new UrlBuilder(Geomajas.getDispatcherUrl());
	url.addPath(LEGEND_ICONS_PATH);
	url.addPath(layer.getServerLayerId());
	url.addPath(name);

	// -- FIELDS
	ListGridField keyField = new ListGridField(KEY_FLD, "Symbool", 45);
	keyField.setAlign(Alignment.CENTER);
	keyField.setType(ListGridFieldType.IMAGE);
	keyField.setImageURLPrefix(url.toString() + "/");
	keyField.setImageURLSuffix(LEGEND_ICONS_TYPE);

	ListGridField valueField = new ListGridField(VALUE_FLD, "Naam");
	valueField.setWidth("*");
	setFields(keyField, valueField);

	// -- VALUES
	final RecordList recordList = new RecordList();
	ClientVectorLayerInfo layerInfo = layer.getLayerInfo();
	UserStyleInfo userStyle = layerInfo.getNamedStyleInfo().getUserStyle();
	FeatureTypeStyleInfo info = userStyle.getFeatureTypeStyleList().get(0);
	 
	if (info.getRuleList().size() > 0) {
		int i = 0;
		for (RuleInfo rule : info.getRuleList()) {
			String title = (rule.getTitle() != null ? rule.getTitle() : rule.getName());
			if (title == null) {
				
				title = layerInfo.getNamedStyleInfo().getName();
			}
			recordList.add(createRecord(title, i));
			i++;
		}
	}
	setData(recordList);
}
 
开发者ID:geomajas,项目名称:geomajas-project-client-gwt,代码行数:54,代码来源:LayerInfo.java

示例11: getUserStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
@Override
public UserStyleInfo getUserStyle() {
	return null;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:5,代码来源:LegendGraphicComponentImpl.java

示例12: getFirstRule

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
private RuleInfo getFirstRule(UserStyleInfo userStyle){
	FeatureTypeStyleInfo fts = userStyle.getFeatureTypeStyleList().get(0);
	return fts.getRuleList().get(0);
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:5,代码来源:ImageServiceVectorTileTest.java

示例13: getUserStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
@Override
public UserStyleInfo getUserStyle() {
	return userStyle;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:5,代码来源:DefaultLegendGraphicMetadata.java

示例14: testMixedGeometryStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
@Test
public void testMixedGeometryStyle() throws LayerException {
	UserStyleInfo style = styleConverterService.convert(layerBeansMixedGeometryStyleInfo, "geometry");
	List<RuleInfo> rules = style.getFeatureTypeStyleList().get(0).getRuleList();
	Assert.assertEquals(3, rules.size());
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:7,代码来源:StyleConverterServiceTest.java

示例15: getUserStyle

import org.geomajas.sld.UserStyleInfo; //导入依赖的package包/类
public UserStyleInfo getUserStyle() {
	return null;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:4,代码来源:LegendGraphicServiceTest.java


注:本文中的org.geomajas.sld.UserStyleInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。