Exemple #1
0
        public void PI_Init(int nToolID, EngineInterface engineInterface, XmlElement pXmlProperties)
        {
            DebugMessage($"PI_Init() Entering; ToolID={_toolID}");

            _toolID          = nToolID;
            _engineInterface = engineInterface;
            _xmlProperties   = pXmlProperties;

            // Use the information in the pXmlProperties parameter to get the input xml field name
            XmlElement configElement = XmlHelpers.GetFirstChildByName(_xmlProperties, "Configuration", true);

            if (configElement != null)
            {
                getConfigSetting(configElement, Constants.GROUPFIELDKEY, ref _groupField);
                getConfigSetting(configElement, Constants.XFIELDKEY, ref _xField);
                getConfigSetting(configElement, Constants.YFIELDKEY, ref _yField);

                getConfigSetting(configElement, Constants.CONCAVITYKEY, ref _sConcavity);
                getConfigSetting(configElement, Constants.SCALEFACTORKEY, ref _sScaleFactor);
            }

            // Re-initialise dictionary if the tool is run a second time.
            _dicPoints = new Dictionary <string, List <Tuple <Double, Double> > >();

            _outputHelper = new PluginOutputConnectionHelper(_toolID, _engineInterface);

            DebugMessage($"PI_Init() Exiting; ToolID={_toolID}");
        }
Exemple #2
0
        /*
         * private void prep()
         * {
         *  // Exit if already done (safety)
         *  if (_recordInfoOut != null)
         *      return;
         *
         *  _recordInfoOut = new AlteryxRecordInfoNet.RecordInfo();
         *
         *  populateRecordInfoOut();
         *
         *  _recordCopier = new RecordCopier(_recordInfoOut, _recordInfoIn, true);
         *
         *  uint countFields = _recordInfoIn.NumFields();
         *  for (int i = 0; i < countFields; ++i)
         *  {
         *      var fieldName = _recordInfoIn[i].GetFieldName();
         *
         *      var newFieldNum = _recordInfoOut.GetFieldNum(fieldName, false);
         *      if (newFieldNum == -1)
         *          continue;
         *
         *      _recordCopier.Add(newFieldNum, i);
         *  }
         *
         *  _recordCopier.DoneAdding();
         *
         *  _outputHelper.Init(_recordInfoOut, "Output", null, _xmlProperties);
         * }
         */

        /*
         * private void populateRecordInfoOut()
         * {
         * _recordInfoOut = new AlteryxRecordInfoNet.RecordInfo();
         *
         *
         * // Copy the fieldbase structure of the incoming record
         * uint countFields = _recordInfoIn.NumFields();
         * for (int i = 0; i < countFields; ++i)
         * {
         *  FieldBase fbIn = _recordInfoIn[i];
         *  var currentFieldName = fbIn.GetFieldName();
         *
         *  _recordInfoOut.AddField(currentFieldName, fbIn.FieldType, (int)fbIn.Size, fbIn.Scale, fbIn.GetSource(), fbIn.GetDescription());
         * }
         *
         *
         * // Add the output columns at the end
         * _recordInfoOut.AddField("ConcaveHull_Polygon_Sequence", FieldType.E_FT_Int32, Constants.INT32_FIELDSIZE, 0, "", "");
         * _recordInfoOut.AddField("ConcaveHull_Polygon_XCoord", FieldType.E_FT_Double, Constants.DOUBLE_FIELDSIZE, 0, "", "");
         * _recordInfoOut.AddField("ConcaveHull_Polygon_YCoord", FieldType.E_FT_Double, Constants.DOUBLE_FIELDSIZE, 0, "", "");
         * }
         */


        ////////////
        // HELPERS


        private void getConfigSetting(XmlElement configElement, string key, ref string memberToSet)
        {
            XmlElement xe = XmlHelpers.GetFirstChildByName(configElement, key, false);

            if (xe != null)
            {
                if (!string.IsNullOrWhiteSpace(xe.InnerText))
                {
                    memberToSet = xe.InnerText;
                }
            }
        }