क्या किसी ने इसे कार्यान्वित किया है, या पता है कि इसे लागू करना मुश्किल होगा या कोई पॉइंटर्स होगा? HQL में:मानदंड स्पैटलियल रेस्त्रां.इस्विथिनडिस्टेंस एनएचबीर्नेट। सैटियल
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
// TODO: Implement
throw new NotImplementedException();
}
NHibernate.Spatial.Criterion.SpatialRestrictions
से मैं "जहां NHSP.Distance (बिंदु संपत्ति,)" का उपयोग कर सकते हैं। लेकिन इस क्वेरी को मेरी मौजूदा मानदंड क्वेरी के साथ जोड़ना चाहते हैं।
पल मैं एक किसी न किसी बहुभुज बना रहा हूं, और का उपयोग करcriteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon));
संपादित SpatialRelationCriterion पर निर्माता ओवरलोडिंग से काम कर रहे एक प्रोटोटाइप समझे के लिए
, नई SpatialRelation.Distance जोड़ने
public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance)
{
return new SpatialRelationCriterion(propertyName, SpatialRelation.Distance, anotherGeometry, distance);
}
ने SpatialRelationCriterion
पर एक नया फ़ील्ड जोड़ाprivate readonly double? distance;
public SpatialRelationCriterion(string propertyName, SpatialRelation relation, object anotherGeometry, double distance)
: this(propertyName, relation, anotherGeometry)
{
this.distance = distance;
}
संपादित ToSqlString
object secondGeometry = Parameter.Placeholder;
if (!(this.anotherGeometry is IGeometry))
{
secondGeometry = columns2[i];
}
if (distance.HasValue)
{
builder.Add(spatialDialect.GetSpatialRelationString(columns1[i], this.relation, secondGeometry, distance.Value, true));
}
else
{
builder.Add(spatialDialect.GetSpatialRelationString(columns1[i], this.relation, secondGeometry, true));
}
MsSql2008SpatialDialect
public SqlString GetSpatialRelationString(object geometry, SpatialRelation relation, object anotherGeometry, double distance, bool criterion)
{
var x = new SqlStringBuilder(8)
.AddObject(geometry)
.Add(".ST")
.Add(relation.ToString())
.Add("(")
.AddObject(anotherGeometry)
.Add(")");
if (criterion)
{
x.Add(" < ");
x.AddObject(distance.ToString());
}
return x.ToSqlString();
}
सुनिश्चित नहीं हैं कि में ISpatialDialect.GetSpatialRelationString
कार्यान्वित अधिभार अतिभारित क्यों AddParameter नहीं किया जा रहा?
मुझे एक ही समस्या है, और अब तक कोई भी पूर्ण पैच/फिक्स/जो भी नहीं मिला है। क्या आपने इसे हल किया था, या आप एचक्यूएल संस्करण के साथ गए थे? – Liedman
सोचें उपर्युक्त दृष्टिकोण के साथ चला गया, और काम करने के लिए डीएलएल recompilled, लेकिन अभी भी प्रयोगात्मक कोड था। – Ian
@Amresh क्या आप प्रस्तावित समाधान ओपी से संतुष्ट नहीं हैं? – Eranga