Ejemplo n.º 1
0
    def __init__(self):
        AbstractTopologyRuleFactory.__init__(
            self, "UserDefinedRule", "User defined rule GSoC2020",
            "This rule allows the user to define a data check expression and another expression to correct it. The dataset features are evaluated for the check expression and it gives a boolean. If the result is False,the feature dont fulfill the rule and it creates a entry in the error report. If the result is True, the feature fulfills the expression. On Inspector de errores del Plan de topologia window we can remove the feature or apply the corrective expression. \n\n The check and corrective expression are create on gvSIG Cosa languaje.",
            None)

        pathName = gvsig.getResource(__file__, 'UserDefinedRule.json')
        url = File(pathName).toURL()
        gvsig.logger(str(url))
        json = RuleResourceLoaderUtils.getRule(url)
        self.load_from_resource(url, json)

        dynObjectManager = ToolsLocator.getDynObjectManager()
        self.parametersDefinition = dynObjectManager.createDynClass(
            "UserDefinedRuleParameters", "UserDefinedRuleParameters")
        self.parametersDefinition.addDynFieldString(
            "CheckExpression").setLabel("Check expression").setDescription("")
        self.parametersDefinition.addDynFieldString(
            "CorrectiveExpression").setLabel(
                "Corrective expression").setDescription("")
Ejemplo n.º 2
0
 def createRuleParameters(self):
     dynObjectManager = ToolsLocator.getDynObjectManager()
     parameters = dynObjectManager.createDynObject(
         self.parametersDefinition)
     return parameters