POST
|
The featureClasses are indeed in different datasets, but their tolerance is the same (predefined in our database-schema). Actually this tolerance is much greater then the obtained error, while the former is set to 0.0001m (for the whole SDE) the latter is around 0.0000000009 as mentioned before, so I wonder why the engine recognizes this difference anyway... Both FCs are stored within an SDE.
... View more
03-02-2014
10:27 PM
|
0
|
0
|
3
|
POST
|
Hey around, I have a two featureClasses of type Polygon where the slave-class depends on the master-class. Having said this I want to reshape some portions of the slave-class (I call them Candidates within my code) by the appropriate paths within the master-class. So I start up querying the slaves that belong to a given master-features by using a spatial query (intersect). Now I loop every point within the slave and compare them to the points within the master. I assume the following condition for my candidate: The from-point and the to-point of the Candidate coincide the master-geometry. So I calculate the distance of the points within the slave-geometry to the master-geometry using the IProximityOperator-interface (with master-geom as proxy). A distance of 0 indicates that the point is on the master-geometry. So I build up the candidates as ICurve-members by adding all the points that do NOT coincide the master-geometry and finally append the from- and to-point (which DO coincide). Now I have a set of candidates that represent ICurve-members. The following code retrieves the candidates:
IPointCollection4 points = (IPointCollection4)slave.Feature.Shape; // the points of the slave-feature
IPoint fromPoint = null; // fromPoint of the candidate
IPoint toPoint = null; // toPoint of the candidate
IPolyline curve = new PolylineClass(); // the geometry of the candidate to add to the result-list
IPointCollection curvePoints = (IPointCollection)curve;
for (int j = 19; j < 22; j++) // consider only these three points
{
// iterate through the points of the slave-geometry
IPoint point = points.get_Point(j);
double distance = proxy.ReturnDistance(point); // distance from every point within the slave to the master-geometry
if (distance > TestClass.Tolerance) // point is totally outside
{
// does not happen in our test-case
// ...
}
else if (distance < TestClass.Tolerance && distance > 0) // point is within the tolerance so it might be a candidate
{
curvePoints.AddPoint(point);
}
else
{
// point touches the outline of the feature. These touching points form the borders of the correction
if (fromPoint == null) fromPoint = point; // set the fromPoint if not exists
toPoint = point; // set the toPoint
// terminate the candidate and append it to the result
IRelationalOperator relOp = (IRelationalOperator)fromPoint;
if (!relOp.Equals(toPoint))
{
// terminate the current curve
// add the fromPoint to the curve
object before = (object)0;
object after = Type.Missing;
curvePoints.AddPoint(fromPoint, ref before, ref after);
// add the toPoint to the curve
curvePoints.AddPoint(toPoint);
fromPoint = point; // make the current toPoint the next fromPoint
toPoint = null;
Candidate candidate = new Candidate(curve);// build a new (temporary) candidate from the curve
result.Add(candidate);
}
}
}
What I do next is getting the actual reshaper-geometry from the master-feature. Therefor I extract the portion of the master-geometry that fits from- and to-point of my candidate using this code:
IPoint fromPoint = this.Geometry.FromPoint; // "this" is the candidate we retrieved in the previos code
IPoint toPoint = this.Geometry.ToPoint;
double fromDistance = 0, toDistance = 0; // distances along the curve
// if these variables are not equal 0 the given point does not belong to the curve
double fromAcrossDistance = 0, toAcrossDistance = 0; // distances across the curve
// get the ring that forms the masterGeometry in order to access the methods for querying near points
IRing ring = new RingClass();
((ISegmentCollection) ring).AddSegmentCollection((ISegmentCollection) masterGeometry);
// calculate the distance of the fromPoint to the master-geometries along its curve
ring.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, fromPoint, false, null, ref fromDistance, ref fromAcrossDistance, false);
// calculate the distance of the toPoint to the master-geometries along its curve
ring.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, toPoint, false, null, ref toDistance, ref toAcrossDistance, false);
// when either the from- or the toPoint does not coincide with the geometry we return an empty curve
// obviously here is the problem
// although we got the from- and toPoints of the candidate (this) by checking if their distance to the masterGeometry is 0 we get some (quite small)
// difference to 0 in the distances accross the curve
if (fromAcrossDistance > 0 || toAcrossDistance > 0) return (ICurve) new Path();
What is strange in here is that for the same candidate (whose from- and to-point are on the master-geometry, compare condition) we get from/toAcrossDistances that are not exactly 0 but sth. around 0.0000009 or so. why do IRing#QueryPointAndDistance and IProximityOperator#ReturnDistance behave so different and how can I avoid this? I hope that you can follow my thoughts and help me finding out the issue behind. I append two shape-files with the mentioned features also. Bye
... View more
02-21-2014
01:56 AM
|
0
|
2
|
392
|
POST
|
As I already assumed reproducing this error could become hard...
... View more
07-31-2013
01:59 AM
|
0
|
0
|
290
|
POST
|
I try to... The masterClass serves only for information, this is where the Reshaper came from. The slave (in the code above this is the editGeometry) should be reshaped by the Reshaper that has been derived from the MasterClass. I hope it works...
... View more
07-30-2013
06:29 AM
|
0
|
0
|
290
|
POST
|
Are the shaper geometry and edit geometry simple? Yeap, checked it out bye making QI-call to ITopologicalOperator.
... View more
07-29-2013
12:01 AM
|
0
|
0
|
290
|
POST
|
You may use the from- and toPoint of a given feature store the values to the labels position. But as far as I know the outer rings of polygons are always stored clockwise, inner rings counter-clockwise (at least inside a GDB)
... View more
07-26-2013
05:27 AM
|
0
|
0
|
4
|
POST
|
Thanks for the reply, as I do not enabled m- or z-values I can ensure thats not the problem. I post some code that may help to identify the problem: IGeometryCollection rings = (IGeometryCollection) editGeometry; // the rings of the edit-geometry IGeometryCollection paths = (IGeometryCollection) reshaper; // the paths of the reshaper if (paths.GeometryCount > 1) throw new ArgumentException("The reshape-geometry must be single-part"); for (int i = 0; i < rings.GeometryCount; i++) { // get the affected rings of the current polygon IRelationalOperator relOp1 = (IRelationalOperator) reshaper.FromPoint; IRelationalOperator relOp2 = (IRelationalOperator) reshaper.ToPoint; // check if Ring touches from- and toPoint of the reshaper if (relOp1.Touches(singlePolygon) && relOp2.Touches(singlePolygon)) { IPath path = (IPath) paths.get_Geometry(0); bool res = ring.Reshape(path); // only in case of success the ring is reshaped if (res && !ring.IsEmpty) return editGeometry; } } I just figured out that the spatial-reference of the from- and toPoint of the ring is NULL although the rings reference-system is set. As this was also the problem on my last topic I assume it also has to do with the current one, but I don´t know why the reference gets lost or how I can reset it if the according ring already has one... EDIT: Sry, I had a writing-mistake, the error-code is -2147220935 rather then 936, so it fits to the received error-message: "an internal error has occured in the geometry system".
... View more
07-25-2013
11:37 PM
|
0
|
0
|
290
|
POST
|
Hey there, after being glad to have solved my last problem I just come up with a new one which I can´t figure out. When reshaping a polygon I use Ring#Reshape(IPath), which gives me a boolean if all worked fine. Unfortunelty it won´t give me any return-value but an exception which is -2147220936. I just looked the codes and found NETWORK_E_EDIT_SESSION_IN_PROGRESS but as the last problem wasn´t related with any Network-features (since I do not use them at all) I´ll bet this error has also nothing to do with this confusing message. So I googled for the error-code and found out that the actual error-message to this code is "The coordinates or measures are out of bounds." (which I cannot conform again as I do not receive any error-message). But as the concerned feature is located in the centre of my featureClass I cannot imagine this is really the clue. So which error is right and what exactly does it have to do with my problem of reshaping an IRing?
... View more
07-25-2013
07:36 AM
|
0
|
8
|
1093
|
POST
|
Thanks for the hint, actually the spatial references of the concerned featureClasses is set correctly, it seems its getting lost while doing some geometric operations on the features. This is why I have to reset it to the reference set in the featureClass.
... View more
07-25-2013
06:35 AM
|
0
|
0
|
13
|
POST
|
I finally managed the issue by setting the spatial reference of the geometry. But I wonder why this worked all the time before without setting the reference...
... View more
07-24-2013
11:21 PM
|
0
|
0
|
13
|
Online Status |
Offline
|
Date Last Visited |
Monday
|