Select to view content in your preferred language

Problem with function Locate

656
0
11-16-2010 03:21 AM
RedjeKalio
Emerging Contributor
Hello everybody,

I have a little boring problem with the function Locate(IPoint point, double tolerence) of IDisplayList. It simply don't work. It returns always null what every the value of the tolerence. I have try with a tolerence of 100 or 0.0001), the return value is always null. This is my code snipped :

[PHP][...]
ICachedGraphicFeatureLayer cachedGraphicFeatureLayer = new ForceElementLayerClass() as ICachedGraphicFeatureLayer;

// Set the symbol size and SizeIsRatio properties of the layer.
IForceElementLayer forceElementLayer = cachedGraphicFeatureLayer as IForceElementLayer;
           
forceElementLayer.Size = forceElementSize;
forceElementLayer.SizeIsRatio = keepForceElementRatio;

ESRI.ArcGIS.Geometry.Point point = new ESRI.ArcGIS.Geometry.Point() {
   X = -116.627464540677, Y = 35.606039469217
};
ICachedGraphic graphic = MoleUtilities.CreateMoleUnit("SFAPWMSA-------", null, point, 2);

ICachedGraphicFeatureLayer cachedGraphicFeatureLayer = layer as ICachedGraphicFeatureLayer;

cachedGraphicFeatureLayer.DisplayList.Add(graphic);

ICachedGraphicSelection selectionInfo = cachedGraphicFeatureLayer as ICachedGraphicSelection;
ISet set = cachedGraphicFeatureLayer.DisplayList.Locate(point, 100);
[...]

/// <summary>
/// Creates a MOLE unit/Force Element with the specified attributes
/// </summary>
/// <param name="SymbolIdCode">Symbol Id Code of the Unit/Force Element</param>
/// <param name="propSet">MOLE Property Set</param>
/// <param name="point">IPoint location of the unit</param>
/// <param name="Size">Unit Size</param>
/// <returns>MOLE ICachedGraphic interface of Unit</returns>
public static ICachedGraphic CreateMoleUnit(string SymbolIdCode, IPropertySet propSet, IPoint point, double Size) {
ICachedGraphic cachedGraphic = null;
IFEGraphic forceElementGraphic = null;

if (UnitGraphicFactory == null) {
  Trace.WriteLine("FEGraphicFactory is null, can't continue with Unit Create!");
  return null;
}

forceElementGraphic = UnitGraphicFactory.Make(SymbolIdCode);

if (forceElementGraphic == null) {
  Trace.WriteLine("FEGraphicFactory failed to create Unit from selected SIC:"
   + SymbolIdCode + ", can't continue with Unit Create!");
  return null;
} else {
  // Debug.WriteLine("Created Unit from selected SIC: " + SymbolIdCode);
}

forceElementGraphic.Style = StyleForCreate;

IForceElement forceElement = new ForceElementClass();

forceElement.PropertySet = propSet;
forceElement.Shape = point;
forceElement.MessageString = SymbolIdCode;

forceElementGraphic.ForceElement = forceElement;

cachedGraphic = forceElementGraphic as ICachedGraphic;
IGeometry pGeo = point as IGeometry;
cachedGraphic.Size = Size;
cachedGraphic.Geometry = pGeo;
cachedGraphic.IsLocked = false;

return cachedGraphic;
}[/PHP]

Could you say me what's wrong with my code ?

Regards,
Redjos
0 Kudos
0 Replies