[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] Read/Writeable Layers with Mapgraphics ...and a Comment
|
A couple of questions (and thanks for taking the time to read them!).
(1) How do I create a layer that isnt read-only? Where I can use all the
standard tools in the UDig menu?
I have some code that works, but it uses a deprecated geotools method
(FeatureTypeFactory.newFeatureType):
try
{
Map map = ApplicationGISInternal.getActiveMap();
IGeoResource resource = null;
try
{
/* code to construct the underlying feature type for a layer */
AttributeType geom = AttributeTypeFactory.newAttributeType("the_geom",
Geometry.class);
AttributeType idType = AttributeTypeFactory.newAttributeType("theid",
Integer.class);
AttributeType nameType =
AttributeTypeFactory.newAttributeType("thename", String.class);
AttributeType descriptionType =
AttributeTypeFactory.newAttributeType("thedescription", String.class);
/* add other attribute types here */
FeatureType featureType = FeatureTypeFactory.newFeatureType(new
AttributeType[] {geom, idType, nameType, descriptionType}, "2D Area Layer");
resource = CatalogPlugin.getDefault().getLocalCatalog()
.createTemporaryResource(featureType);
} catch (FactoryRegistryException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalArgumentException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SchemaException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
Layer layer = map.getLayerFactory().createLayer(resource);
...is there a better (i.e. non-deprecated) way to do this?
(2) I'd like to create a layer with two resources - first a writeable layer
as above, that supports all geometries, and also associate a mapgraphic
extension with that layer to draw on said layer - is there a way to add both
of these resources to the same layer? I can get one or the other to work
but not both.
..and finally my comment. What a superb piece of work uDig is, just truly
amazing ... I cant begin to thank you for the effort you have expended and
the effort it has saved me!
Kind Regards,
Pete Cornwell
--
View this message in context: http://www.nabble.com/Read-Writeable-Layers-with-Mapgraphics-...and-a-Comment-tf3011852.html#a8364678
Sent from the udig-devel mailing list archive at Nabble.com.