public void CopyFeaturesWithAttributes() { IFeatureSet fs = BuildFeatureSet(); IFeatureSet res5 = fs.CopyFeatures(true); Assert.AreEqual(res5.Features.Count, 3); Assert.AreEqual(res5.Features[0].DataRow["Test"], "hello"); }
public void CopyFeaturesWithoutAttributes() { IFeatureSet fs = BuildFeatureSet(); IFeatureSet res6 = fs.CopyFeatures(false); Assert.AreEqual(res6.Features.Count, 3); Assert.AreEqual(res6.Features[0].DataRow.ItemArray.Length, 0); }
/// <summary> /// This routine takes a DotSpatial Featureset and makes a clone and then reprojects it to the requested Projection. /// It returns a clone of the input so the input is not altered in any way. /// </summary> /// <param name="self">This featureSet.</param> /// <param name="targetPrj">The projection of the target clone FeatureSet.</param> /// <returns>A reprojected clone of the surce FeatureSet.</returns> public static IFeatureSet ReprojectedClone(this IFeatureSet self, ProjectionInfo targetPrj) { // input check if (self == null || targetPrj == null) { return(null); } self.FillAttributes(); IFeatureSet fsClone = self.CopyFeatures(true); fsClone.IndexMode = false; fsClone.Reproject(targetPrj); // success so return the reprojected clone FeatureSet return(fsClone); }
/// <summary> /// Executes the ReprojectFeatureSet Operation tool programaticaly. /// </summary> /// <param name="featureSet">The input FeatureSet.</param> /// <param name="sourceProjection">The input Expression string to select features to Delete.</param> /// <param name="destProjection">The target projected coordinate system to reproject the featureset to</param> /// <param name="output">The output FeatureSet.</param> /// <param name="cancelProgressHandler">The progress handler.</param> /// Ping deleted "static" for external testing /// <returns></returns> public bool Execute( IFeatureSet featureSet, ProjectionInfo sourceProjection, ProjectionInfo destProjection, IFeatureSet output, ICancelProgressHandler cancelProgressHandler) { output.CopyFeatures(featureSet, true); output.Projection = featureSet.Projection; if (sourceProjection != null) { output.Projection = sourceProjection; } output.Reproject(destProjection); output.SaveAs(output.Filename, true); return(true); }
/// <summary> /// Executes the ReprojectFeatureSet Operation tool programaticaly. /// </summary> /// <param name="featureSet">The input FeatureSet.</param> /// <param name="sourceProjection">The input Expression string to select features to Delete.</param> /// <param name="destProjection">The target projected coordinate system to reproject the featureset to</param> /// <param name="output">The output FeatureSet.</param> /// <param name="cancelProgressHandler">The progress handler.</param> /// Ping deleted "static" for external testing /// <returns></returns> public bool Execute(IFeatureSet featureSet, ProjectionInfo sourceProjection, ProjectionInfo destProjection, IFeatureSet output, ICancelProgressHandler cancelProgressHandler) { output.CopyFeatures(featureSet, true); output.Projection = featureSet.Projection; if(sourceProjection != null) output.Projection = sourceProjection; output.Reproject(destProjection); output.SaveAs(output.Filename, true); return true; }