private void ProxyCreateRandom() { // Default sample size int pSample = 25; var mSelectedLayer = ExtFunctions.GetSelectedLayer(theMap); IFeatureLayer mLayer = null; if (mSelectedLayer == null || !(mSelectedLayer is IFeatureLayer)) { this.Log("No feature layer selected, please select a layer and try again."); return; } mLayer = (IFeatureLayer)mSelectedLayer; var mFrmInputBox = new frmInputBox("Specify size of sample", "Please specify number of items to be included in the output file", pSample); if (DialogResult.OK == mFrmInputBox.ShowDialog()) { if (mFrmInputBox.GetAsInteger() != null) { pSample = (int)mFrmInputBox.GetAsInteger(); Utilities.LogDebug("Using specified sample size: " + pSample); } else if (mFrmInputBox.GetAsPercent() != null) { int mPercentage = (int)mFrmInputBox.GetAsPercent(); IFeatureSet mFeatureSet = mLayer.DataSet; pSample = (int)Math.Floor(((double)mPercentage * (double)mFeatureSet.NumRows()) / 100); Utilities.LogDebug("Using " + mPercentage + "% : " + pSample); } else { Utilities.LogDebug("Using default sample size: " + pSample); } this.Log(pSample.ToString()); if (pSample > 0) { var mRndFeatureSet = ExtFunctions.CreateRandomSelection(mLayer, pSample); if (mRndFeatureSet == null) { Utilities.LogDebug("Creation of random selection layer failed"); return; } var mLayer2 = (IFeatureLayer)ExtFunctions.GetFeatureLayer(theMap.Layers, mRndFeatureSet, mLayer.LegendText + " : random", ExtFunctions.CopyLayerSymbolizer(mLayer), mLayer.Projection); ExtFunctions.AddLabelsForFeatureLayer(mLayer2, "Address unit numbers", "#[ADDRESSUNITNR], [ROADNAME_EN]", GoogleMapsColors.BoundaryMajor); } } }