public static bool Transform(this DMesh3 dMesh, SpatialReference to) { string crs = dMesh.FindMetadata("CRS") as string; if (crs != null && crs != "") { SpatialReference from = new SpatialReference(null); if (crs.Contains("+proj")) { from.ImportFromProj4(crs); } else if (crs.StartsWith("epsg") || crs.StartsWith("EPSG")) { int epsg = int.Parse(crs.Split(':')[1]); from.ImportFromEPSG(epsg); } else { from.ImportFromWkt(ref crs); }; try { CoordinateTransformation trans = new CoordinateTransformation(from, to); for (int i = 0; i < dMesh.VertexCount; i++) { if (dMesh.IsVertex(i)) { Vector3d vertex = dMesh.GetVertex(i); double[] dV = new double[3] { vertex.x, vertex.y, vertex.z }; trans.TransformPoint(dV); AppState.instance.mapTrans.TransformPoint(dV); dMesh.SetVertex(i, new Vector3d(dV)); } } ; return(true); } catch { return(false); } } try { for (int i = 0; i < dMesh.VertexCount; i++) { if (dMesh.IsVertex(i)) { Vector3d vertex = dMesh.GetVertex(i); double[] dV = new double[3] { vertex.x, vertex.y, vertex.z }; AppState.instance.mapTrans.TransformPoint(dV); dMesh.SetVertex(i, new Vector3d(dV)); } } ; return(true); } catch { return(false); } }
public int Transform(OSGeo.OSR.CoordinateTransformation trans) { int ret = OgrPINVOKE.Geometry_Transform(swigCPtr, OSGeo.OSR.CoordinateTransformation.getCPtr(trans)); if (OgrPINVOKE.SWIGPendingException.Pending) { throw OgrPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { ///GDAL setup RESTful.GdalConfiguration.ConfigureOgr(); ///Working with data trees allows us to only call the osr coordinate transformation once, which seems to be expensive GH_Structure <GH_Point> sourcePoints = new GH_Structure <GH_Point>(); DA.GetDataTree(0, out sourcePoints); GH_Structure <GH_Point> destPoints = new GH_Structure <GH_Point>(); string sourceString = string.Empty; DA.GetData(1, ref sourceString); OSGeo.OSR.SpatialReference sourceSRS = new OSGeo.OSR.SpatialReference(""); sourceSRS.SetFromUserInput(sourceString); if (sourceSRS.Validate() == 1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Source SRS."); return; } string destString = string.Empty; DA.GetData(2, ref destString); OSGeo.OSR.SpatialReference destSRS = new OSGeo.OSR.SpatialReference(""); destSRS.SetFromUserInput(destString); if (destSRS.Validate() == 1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Destination SRS."); return; } OSGeo.OSR.CoordinateTransformation trans = new OSGeo.OSR.CoordinateTransformation(sourceSRS, destSRS); foreach (var path in sourcePoints.Paths) { List <GH_Point> branchPts = (List <GH_Point>)sourcePoints.get_Branch(path); foreach (var sp in branchPts) { OSGeo.OGR.Geometry destOgrPoint = new OSGeo.OGR.Geometry(wkbGeometryType.wkbPoint); destOgrPoint.AddPoint(sp.Value.X, sp.Value.Y, sp.Value.Z); destOgrPoint.AssignSpatialReference(sourceSRS); destOgrPoint.Transform(trans); Point3d destPoint = new Point3d(destOgrPoint.GetX(0), destOgrPoint.GetY(0), destOgrPoint.GetZ(0)); destPoints.Append(new GH_Point(destPoint), path); destOgrPoint.Dispose(); } } DA.SetDataTree(0, destPoints); }
/// <summary> /// Convert a netDXF Vector3 in z-up coordinate frame to a Vectir3D in Y-up coordinate frame /// using the optional Coordinate Transform to reproject the point if present /// </summary> /// <param name="v">DXF.Vector3</param> /// <param name="ct">Coordinate transform</param> /// <returns>Vector3d</returns> public static Vector3d ToVector3d(this DXF.Vector3 v, CoordinateTransformation ct = null) { double[] vlocal = new double[3] { v.X, v.Y, v.Z }; if (ct != null) { ct.TransformPoint(vlocal); } return(new Vector3d((float)vlocal[0], (float)vlocal[2], (float)vlocal[1])); }
/// <summary> /// Cibvert vector3D in Y-up coordinate frame to a netDXF Vector3 in z-up coordinate frame /// using the optional CoordinateTranform to reproject the dpoint if present /// </summary> /// <param name="v"> Vector3d</param> /// <param name="transform">Coordinate Transform</param> /// <returns>DXF.Vector3</returns> public static DXF.Vector3 ToDxfVector3(this Vector3d v, CoordinateTransformation transform = null) { double[] vlocal = new double[3] { v.x, v.z, v.y }; if (transform != null) { transform.TransformPoint(vlocal); } return(new DXF.Vector3(vlocal[0], vlocal[1], vlocal[2])); }
public static void CoordTransform(this OSGeo.OSR.SpatialReference srcSR, OSGeo.OSR.SpatialReference destSR, params double[][] inouts) { if (srcSR.IsSame(destSR) <= 0) { using (OSGeo.OSR.CoordinateTransformation coordinateTransformation = new OSGeo.OSR.CoordinateTransformation(srcSR, destSR)) { foreach (var inout in inouts) { coordinateTransformation.TransformPoint(inout); } } } }
public static Geometry CTrans(this Geometry geom, int fromEpsg, int toEpsg = 4326) { var mSrcProj = ExtFunctions.GetSpatialReferenceByEPSG(32640); var mTgtProj = ExtFunctions.GetSpatialReferenceByEPSG(4326); var mTransformation = new OSGeo.OSR.CoordinateTransformation(mSrcProj, mTgtProj); if (fromEpsg != toEpsg) { geom.Transform(mTransformation); } mTransformation.Dispose(); mSrcProj.Dispose(); mTgtProj.Dispose(); return(geom); }
public void LoadAffineTransform(string filename) { using (OSGeo.GDAL.Dataset dataset = OSGeo.GDAL.Gdal.Open(filename, OSGeo.GDAL.Access.GA_ReadOnly)) { AffineTransform = new double[6]; dataset.GetGeoTransform(AffineTransform); string targetProjection = "GEOGCS[\"Moon 2000\", DATUM[\"D_Moon_2000\", SPHEROID[\"Moon_2000_IAU_IAG\",1737400.0,0.0]], PRIMEM[\"Greenwich\",0], UNIT[\"Decimal_Degree\",0.0174532925199433]]"; var src = new OSGeo.OSR.SpatialReference(dataset.GetProjectionRef()); var dst = new OSGeo.OSR.SpatialReference(targetProjection); pixelToLatLon = new OSGeo.OSR.CoordinateTransformation(src, dst); latLonToPixel = new OSGeo.OSR.CoordinateTransformation(dst, src); } }
public MemoryMappedInt16Terrain(string referenceImage) { Open(TerrainImageFile); using (OSGeo.GDAL.Dataset dataset = OSGeo.GDAL.Gdal.Open(referenceImage, OSGeo.GDAL.Access.GA_ReadOnly)) { _affineTransform = new double[6]; dataset.GetGeoTransform(_affineTransform); string projection = dataset.GetProjectionRef(); var src = new OSGeo.OSR.SpatialReference(projection); var dst = new OSGeo.OSR.SpatialReference(PolarStereographic); _pixelToLineSample = new OSGeo.OSR.CoordinateTransformation(src, dst); } }
public void SavedCode() { using (Dataset dataset = Gdal.Open(Path, Access.GA_ReadOnly)) { if (dataset == null) { throw new Exception($"GDAL couldn't open {Path}"); } Width = dataset.RasterXSize; Height = dataset.RasterYSize; Debug.Assert(dataset.RasterCount == 1); dataset.GetGeoTransform(AffineTransform); Projection = dataset.GetProjectionRef(); var latLonSpatialReference = new OSGeo.OSR.SpatialReference(LatLonProjection); var imgSpatialReference = new OSGeo.OSR.SpatialReference(LatLonProjection); PixelToLatLon = new OSGeo.OSR.CoordinateTransformation(imgSpatialReference, latLonSpatialReference); LatLonToPixel = new OSGeo.OSR.CoordinateTransformation(latLonSpatialReference, imgSpatialReference); } }
/// <summary> /// /// </summary> /// <param name="pFrm"></param> /// <param name="pSrcFileGDB"></param> /// <param name="pSQLFileName"></param> /// <param name="pBatchSize"></param> /// <param name="pAppend"></param> /// <returns></returns> public static ReturnValue ExportFileGDBToMyAbuDhabiDotNetSQL(frmMain pFrm, string pSrcFileGDB, string pSQLFileName, int pBatchSize = 25, bool pAppend = false) { var mRetVal = new ReturnValue(true); NumberFormatInfo mNumFormat = new CultureInfo("en-US", false).NumberFormat; // Open FileGDB var mFileGDBDrv = OSGeo.OGR.Ogr.GetDriverByName("FileGDB"); var mSrcDSrc = mFileGDBDrv.Open(pSrcFileGDB, 1); if (mSrcDSrc == null) { pFrm.Log("Could not open ESRI FGDB: " + pSrcFileGDB, true); mRetVal.Success = false; return(mRetVal); } // Create re-usable projection var mSrcProj = ExtFunctions.GetSpatialReferenceByEPSG(32640); var mTgtProj = ExtFunctions.GetSpatialReferenceByEPSG(4326); var mTransformation = new OSGeo.OSR.CoordinateTransformation(mSrcProj, mTgtProj); int mLineCount = 0; int mFileCount = 1; // Create file to write to var mStreamWriter = new StreamWriter(pSQLFileName + "." + mFileCount, pAppend, Encoding.UTF8, 1024); // Create re-usable feature object OSGeo.OGR.Feature mFeat = null; OSGeo.GDAL.Gdal.SetConfigOption("SHAPE_ENCODING", "UTF-8"); DataSource mDistrictsDataSource = Ogr.Open(DistrictImport.GetShapefileName(), 0); Layer mDistricts = null; if (mDistrictsDataSource != null) { mDistricts = mDistrictsDataSource.GetLayerByIndex(0); } var mRecords = new SignRecord(); // Process address unit signs var mAUSLyr = mSrcDSrc.GetLayerByName("Address_unit_signs"); if (mAUSLyr == null) { mRetVal.AddMessage("Could not find address units layer", true); return(mRetVal); } if (mAUSLyr != null) { pFrm.Log("Opened Address_unit_signs layer from FileGDB for reading..."); int mNumFeatures = mAUSLyr.GetFeatureCount(1); int idxFeat = 0; while (null != (mFeat = mAUSLyr.GetNextFeature())) { var mGeom = mFeat.GetGeometryRef(); Envelope mOrigEnvelope = new Envelope(); mGeom.GetEnvelope(mOrigEnvelope); var mDistrictInfo = mDistricts.GetDistrictByPoint(mGeom, 32640); mGeom.Transform(mTransformation); Envelope mEnvelope = new Envelope(); mGeom.GetEnvelope(mEnvelope); string mWkt; mGeom.ExportToWkt(out mWkt); mRecords.AddToBuffer( mFeat.GetFieldAsString("QR_CODE"), mFeat.GetFieldAsString("ADDRESSUNITNR"), mFeat.GetFieldAsString("ROADNAME_EN").MySQLEscape(), mFeat.GetFieldAsString("ROADNAME_AR").MySQLEscape(), mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMELATIN").MySQLEscape() : "", mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMEARABIC").MySQLEscape() : "", mEnvelope.MinX.ToString(mNumFormat), mEnvelope.MinY.ToString(mNumFormat), mFeat.GetFieldAsString("DESCRIPTION_AR").MySQLEscape(), mFeat.GetFieldAsString("DESCRIPTION_EN").MySQLEscape(), "Address_unit_signs", SignType.addressUnitNumberSign ); idxFeat++; if (idxFeat % pBatchSize == 0 || idxFeat == mNumFeatures) { var mSql = String.Format(sqlStatements.insertUpdateMyAbuDhabiNetSQL, mRecords.GetBuffer()); mStreamWriter.WriteLine(mSql); pFrm.pgBar.ProgressBar.Value = (idxFeat * 100) / mNumFeatures; mLineCount++; if (mLineCount % 500 == 0) { mFileCount++; mStreamWriter.Flush(); mStreamWriter.Close(); mStreamWriter = new StreamWriter(pSQLFileName + "." + mFileCount, pAppend, Encoding.UTF8, 1024); mLineCount = 0; } } } pFrm.Log("Done, processed " + idxFeat + " features..."); mAUSLyr.Dispose(); mAUSLyr = null; } // Process address unit signs var mSNSLyr = mSrcDSrc.GetLayerByName("Street_name_signs"); if (mSNSLyr == null) { mRetVal.AddMessage("Could not find layer Street_name_signs", true); return(mRetVal); } if (mSNSLyr != null) { Debug.WriteLine(mSNSLyr); pFrm.Log("Opened Street_name_signs layer from FileGDB for reading..."); int mNumFeatures = mSNSLyr.GetFeatureCount(1); int idxFeat = 0; mFeat = null; while (null != (mFeat = mSNSLyr.GetNextFeature())) { var mGeom = mFeat.GetGeometryRef(); Envelope mOrigEnvelope = new Envelope(); mGeom.GetEnvelope(mOrigEnvelope); var mDistrictInfo = mDistricts.GetDistrictByPoint(mGeom, 32640); mGeom.Transform(mTransformation); Envelope mEnvelope = new Envelope(); mGeom.GetEnvelope(mEnvelope); string mWkt; mGeom.ExportToWkt(out mWkt); mRecords.AddToBuffer( mFeat.GetFieldAsString("QR_CODE"), "", mFeat.GetFieldAsString("ROADNAME_EN_P1").MySQLEscape() + "/" + mFeat.GetFieldAsString("ROADNAME_EN_P2").MySQLEscape(), mFeat.GetFieldAsString("ROADNAME_AR_P1").MySQLEscape() + "/" + mFeat.GetFieldAsString("ROADNAME_AR_P2").MySQLEscape(), mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMELATIN").MySQLEscape() : "", mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMEARABIC").MySQLEscape() : "", mEnvelope.MinX.ToString(mNumFormat), mEnvelope.MinY.ToString(mNumFormat), "", "", "Street_name_signs", SignType.streetNameSign, "" ); idxFeat++; if (idxFeat % pBatchSize == 0 || idxFeat == mNumFeatures) { var mSql = String.Format(sqlStatements.insertUpdateMyAbuDhabiNetSQL, mRecords.GetBuffer()); mStreamWriter.WriteLine(mSql); Debug.WriteLine(mSql); pFrm.pgBar.ProgressBar.Value = (idxFeat * 100) / mNumFeatures; mLineCount++; if (mLineCount % 500 == 0) { mFileCount++; mStreamWriter.Flush(); mStreamWriter.Close(); mStreamWriter = new StreamWriter(pSQLFileName + "." + mFileCount, pAppend, Encoding.UTF8, 1024); mLineCount = 0; } } } pFrm.Log("Done, processed " + idxFeat + " features..."); mSNSLyr.Dispose(); mSNSLyr = null; } // Process address guide signs var mAGSLyr = mSrcDSrc.GetLayerByName("Address_guide_sign"); if (mAGSLyr == null) { mRetVal.AddMessage("Could not find layer Address_guide_sign", true); return(mRetVal); } if (mAGSLyr != null) { pFrm.Log("Opened Address_guide_sign layer from FileGDB for reading..."); int mNumFeatures = mAGSLyr.GetFeatureCount(1); int idxFeat = 0; mFeat = null; while (null != (mFeat = mAGSLyr.GetNextFeature())) { var mGeom = mFeat.GetGeometryRef(); Envelope mOrigEnvelope = new Envelope(); mGeom.GetEnvelope(mOrigEnvelope); var mDistrictInfo = mDistricts.GetDistrictByPoint(mGeom, 32640); mGeom.Transform(mTransformation); Envelope mEnvelope = new Envelope(); mGeom.GetEnvelope(mEnvelope); string mWkt; mGeom.ExportToWkt(out mWkt); mRecords.AddToBuffer( mFeat.GetFieldAsString("QR_CODE"), "", mFeat.GetFieldAsString("ROADNAME_EN"), mFeat.GetFieldAsString("ROADNAME_AR"), mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMELATIN").MySQLEscape() : null, mDistrictInfo != null ? mDistrictInfo.GetFieldAsString("NAMEARABIC").MySQLEscape() : null, mEnvelope.MinX.ToString(mNumFormat), mEnvelope.MinY.ToString(mNumFormat), "", "", "Address_guide_sign", SignType.addressGuideSign, ""); idxFeat++; if (idxFeat % pBatchSize == 0 || idxFeat == mNumFeatures) { var mSql = String.Format(sqlStatements.insertUpdateMyAbuDhabiNetSQL, mRecords.GetBuffer()); mStreamWriter.WriteLine(mSql); pFrm.pgBar.ProgressBar.Value = (idxFeat * 100) / mNumFeatures; mLineCount++; if (mLineCount % 500 == 0) { mFileCount++; mStreamWriter.Flush(); mStreamWriter.Close(); mStreamWriter = new StreamWriter(pSQLFileName + "." + mFileCount, pAppend, Encoding.UTF8, 1024); mLineCount = 0; } } } pFrm.Log("Done, processed " + idxFeat + " features..."); mAGSLyr.Dispose(); mAGSLyr = null; } mStreamWriter.Flush(); mStreamWriter.Close(); mStreamWriter.Dispose(); mSrcProj.Dispose(); mSrcProj = null; mTgtProj.Dispose(); mTgtProj = null; mTransformation.Dispose(); mTransformation = null; mSrcDSrc.Dispose(); mSrcDSrc = null; mFileGDBDrv.Dispose(); mFileGDBDrv = null; return(mRetVal); }
protected override void SolveInstance(IGH_DataAccess DA) { List <Curve> boundary = new List <Curve>(); DA.GetDataList <Curve>("Boundary", boundary); int Res = -1; DA.GetData <int>("Resolution", ref Res); string fileloc = ""; DA.GetData <string>("File Location", ref fileloc); if (!fileloc.EndsWith(@"\")) { fileloc = fileloc + @"\"; } string prefix = ""; DA.GetData <string>("Prefix", ref prefix); string URL = ""; DA.GetData <string>("REST URL", ref URL); bool run = false; DA.GetData <bool>("run", ref run); string userSRStext = ""; DA.GetData <string>("User Spatial Reference System", ref userSRStext); ///GDAL setup RESTful.GdalConfiguration.ConfigureOgr(); ///TODO: implement SetCRS here. ///Option to set CRS here to user-defined. Needs a SetCRS global variable. //string userSRStext = "EPSG:4326"; OSGeo.OSR.SpatialReference userSRS = new OSGeo.OSR.SpatialReference(""); userSRS.SetFromUserInput(userSRStext); int userSRSInt = Int16.Parse(userSRS.GetAuthorityCode(null)); ///Set transform from input spatial reference to Rhino spatial reference OSGeo.OSR.SpatialReference rhinoSRS = new OSGeo.OSR.SpatialReference(""); rhinoSRS.SetWellKnownGeogCS("WGS84"); ///This transform moves and scales the points required in going from userSRS to XYZ and vice versa Transform userSRSToModelTransform = Heron.Convert.GetUserSRSToModelTransform(userSRS); Transform modelToUserSRSTransform = Heron.Convert.GetModelToUserSRSTransform(userSRS); OSGeo.OSR.CoordinateTransformation coordTransformRhinoToUser = new OSGeo.OSR.CoordinateTransformation(rhinoSRS, userSRS); OSGeo.OSR.CoordinateTransformation coordTransformUserToRhino = new OSGeo.OSR.CoordinateTransformation(userSRS, rhinoSRS); GH_Structure <GH_String> mapList = new GH_Structure <GH_String>(); GH_Structure <GH_String> mapquery = new GH_Structure <GH_String>(); GH_Structure <GH_Rectangle> imgFrame = new GH_Structure <GH_Rectangle>(); FileInfo file = new FileInfo(fileloc); file.Directory.Create(); string size = ""; if (Res != 0) { size = "&size=" + Res + "%2C" + Res; } for (int i = 0; i < boundary.Count; i++) { GH_Path path = new GH_Path(i); //Get image frame for given boundary BoundingBox imageBox = boundary[i].GetBoundingBox(false); Point3d min = Heron.Convert.XYZToWGS(imageBox.Min); Point3d max = Heron.Convert.XYZToWGS(imageBox.Max); Rectangle3d rect = BBoxToRect(imageBox); ///ogr method OSGeo.OGR.Geometry minOgr = Heron.Convert.Point3dToOgrPoint(min); minOgr.Transform(coordTransformRhinoToUser); OSGeo.OGR.Geometry maxOgr = Heron.Convert.Point3dToOgrPoint(max); maxOgr.Transform(coordTransformRhinoToUser); //Query the REST service string restquery = URL + ///legacy method for creating bounding box string //"bbox=" + Heron.Convert.ConvertLat(min.X, 3857) + "%2C" + Heron.Convert.ConvertLon(min.Y, 3857) + "%2C" + Heron.Convert.ConvertLat(max.X, 3857) + "%2C" + Heron.Convert.ConvertLon(max.Y, 3857) + ///ogr method for creating bounding box string "bbox=" + minOgr.GetX(0) + "%2C" + minOgr.GetY(0) + "%2C" + maxOgr.GetX(0) + "%2C" + maxOgr.GetY(0) + "&bboxSR=" + userSRSInt + size + //"&layers=&layerdefs=" + "&imageSR=" + userSRSInt + //"&transparent=false&dpi=&time=&layerTimeOptions=" + "&format=jpg&f=json"; mapquery.Append(new GH_String(restquery), path); string result = ""; if (run) { ///get extent of image from arcgis rest service as JSON result = Heron.Convert.HttpToJson(restquery); JObject jObj = JsonConvert.DeserializeObject <JObject>(result); Point3d extMin = new Point3d((double)jObj["extent"]["xmin"], (double)jObj["extent"]["ymin"], 0); Point3d extMax = new Point3d((double)jObj["extent"]["xmax"], (double)jObj["extent"]["ymax"], 0); ///convert and transform extents to points OSGeo.OGR.Geometry extOgrMin = new OSGeo.OGR.Geometry(wkbGeometryType.wkbPointZM); extOgrMin.AddPoint((double)jObj["extent"]["xmin"], (double)jObj["extent"]["ymin"], 0.0); extOgrMin.Transform(coordTransformUserToRhino); Point3d ogrPtMin = Heron.Convert.OgrPointToPoint3d(extOgrMin); OSGeo.OGR.Geometry extOgrMax = new OSGeo.OGR.Geometry(wkbGeometryType.wkbPointZM); extOgrMax.AddPoint((double)jObj["extent"]["xmax"], (double)jObj["extent"]["ymax"], 0.0); extOgrMax.Transform(coordTransformUserToRhino); Point3d ogrPtMax = Heron.Convert.OgrPointToPoint3d(extOgrMax); ///if SRS is geographic (ie WGS84) use Rhino's internal projection ///this is still buggy as it doesn't work with other geographic systems like NAD27 if ((userSRS.IsProjected() == 0) && (userSRS.IsLocal() == 0)) { rect = new Rectangle3d(Plane.WorldXY, Heron.Convert.WGSToXYZ(extMin), Heron.Convert.WGSToXYZ(extMax)); } else { //rect = new Rectangle3d(Plane.WorldXY, Heron.Convert.UserSRSToXYZ(extMin, userSRSToModel), Heron.Convert.UserSRSToXYZ(extMax, userSRSToModel)); rect = new Rectangle3d(Plane.WorldXY, userSRSToModelTransform * extMin, userSRSToModelTransform * extMax); } ///download image from source string imageQuery = jObj["href"].ToString(); System.Net.WebClient webClient = new System.Net.WebClient(); webClient.DownloadFile(imageQuery, fileloc + prefix + "_" + i + ".jpg"); webClient.Dispose(); } var bitmapPath = fileloc + prefix + "_" + i + ".jpg"; mapList.Append(new GH_String(bitmapPath), path); imgFrame.Append(new GH_Rectangle(rect), path); AddPreviewItem(bitmapPath, rect); } DA.SetDataTree(0, mapList); DA.SetDataTree(1, imgFrame); DA.SetDataTree(2, mapquery); }