Mulitdimensional array

mapworks

New member
Joined
Sep 29, 2011
Messages
4
Programming Experience
5-10
I am trying to create a report that will give me the area of multiple polygons on a layer. There will be an unknown number of layers and polygons. I was thinking I could use a multidimensional array with each row holding the layer name and the area of that polygon then loop through and separate the layers and sum the areas. My problem is that in all the reading I’ve done on the subject I’m not sure of how to initialize the array. I know how many polygons there will be, but am unclear on how do I do it, and would that be the most efficient way of going about this problem? Any help would be appreciated.
 
This is a complete long shot, but could you create a class which would take the values for your polygons, and then use arraylist and add objects to it ? If that makes sense.... I'm sure theres a few ways to do it.. I may of misunderstood your question! (or just be wrong! haha)
 
Leon, thanks for the reply. The problem is that the polygon's layer name must be associated with its area so I can sum all polygon areas on a specific layer (this is a cad program).
 
You would have a Layer class and somewhere you would have a collection of Layers. A Layer object would have a Polygons property that is a collection of Polygon objects. You can loop through the Layers and, for each Layer, loop though its Polygons.
 
Okay, so now I have an array with the layer name and the area, now how would i go about looping through it and if the layer exists then sum the area with the final result being a list of all layers with the sum of all polygons on that layer?
 
Back
Top