// Functions of the same name must differ by their arity! // This is different from C# method overloading! public static StandardEnvironment RegisterGeometryFunctions( [NotNull] this StandardEnvironment env) { env.Register <object, object>("SHAPEAREA", Area); env.Register <object, object>("SHAPELENGTH", Length); // Nice to have: Area/0 and Length/0 that refer to current row's Shape field (whatever it's named) return(env); }
//public static StandardEnvironment RegisterColorFunctions([NotNull] this StandardEnvironment env) //{ // env.Register<double, double, double, IColor>("RGBCOLOR", RgbColor); // env.Register<object, IColor>("RGBCOLOR", RgbColor); // env.Register<double, double, double, double, IColor>("CMYKCOLOR", CmykColor); // env.Register<object, IColor>("CMYKCOLOR", CmykColor); // env.Register<object, IColor>("GRAYCOLOR", GrayColor); // env.Register<object, IColor>("GREYCOLOR", GrayColor); // env.Register<double, double, double, IColor>("HSVCOLOR", HsvColor); // env.Register<object, IColor>("HSVCOLOR", HsvColor); // env.Register<double, double, double, IColor>("HLSCOLOR", HlsColor); // env.Register<object, IColor>("HLSCOLOR", HlsColor); // env.Register<string, IColor>("MAKECOLOR", MakeColor); // env.Register<IColor, string>("FORMATCOLOR", FormatColor); // rename? // return env; //} //public static StandardEnvironment RegisterRepOverrideFunctions( // [NotNull] this StandardEnvironment env) //{ // env.Register<object, object>("PACKREPOVERRIDE", PackRepOverride); // env.Register<object, object>("UNPACKREPOVERRIDE", UnpackRepOverride); // return env; //} public static StandardEnvironment RegisterConversionFunctions( [NotNull] this StandardEnvironment env /*, * [CanBeNull] IMapContext mapContext*/) { //var instance = new ConversionFunctions {MapContext = mapContext}; env.Register <object, object>("mm2pt", ConversionFunctions.mm2pt); env.Register <object, object>("pt2mm", ConversionFunctions.pt2mm); //env.Register<object, object>("mm2mu", instance.mm2mu, instance); //env.Register<object, object>("mu2mm", instance.mu2mm, instance); //env.Register<object, object>("pt2mu", instance.pt2mu, instance); //env.Register<object, object>("mu2pt", instance.mu2pt, instance); return(env); }