def __init__(self, args):
        if len(args) != 0:
            self.execute(args)
        else:
            # Create a dialog for this tool to collect user-specified
            # tool parameters.
            self.sd = ScriptDialog(pluginHost, descriptiveName, self)

            # Specifying the help file will display the html help
            # file in the help pane. This file should be be located
            # in the help directory and have the same name as the
            # class, with an html extension.
            helpFile = self.__class__.__name__
            self.sd.setHelpFile(helpFile)

            # Specifying the source file allows the 'view code'
            # button on the tool dialog to be displayed.
            self.sd.setSourceFile(os.path.abspath(__file__))

            # add some components to the dialog
            self.sd.addDialogFile("Input file", "Input GeoTiff File:", "open",
                                  "GeoTiff Files (*.tif), TIF, TIFF", True,
                                  False)

            # resize the dialog to the standard size and display it
            self.sd.setSize(800, 400)
            self.sd.visible = True
	def __init__(self, args):
		if len(args) != 0:
			self.execute(args)
		else:
			''' Create a dialog for this tool to collect user-specified
			   tool parameters.''' 
			self.sd = ScriptDialog(pluginHost, descriptiveName, self)	
			
			''' Specifying the help file will display the html help
			// file in the help pane. This file should be be located 
			// in the help directory and have the same name as the 
			// class, with an html extension.'''
			self.sd.setHelpFile(name)
	
			''' Specifying the source file allows the 'view code' 
			// button on the tool dialog to be displayed.'''
			self.sd.setSourceFile(os.path.abspath(__file__))
	
			# add some components to the dialog '''
			self.sd.addDialogFile("Input raster file 1 (base)", "Input Base Raster File:", "open", "Raster Files (*.dep), DEP", True, False)
			self.sd.addDialogFile("Input raster file 2 (comparison)", "Input Comparison Raster File:", "open", "Raster Files (*.dep), DEP", True, False)
			
			# Resize the dialog to the standard size and display it '''
			self.sd.setSize(800, 400)
			self.sd.visible = True
    def __init__(self, args):
        if len(args) != 0:
            self.execute(args)
        else:
            ''' Create a dialog for this tool to collect user-specified
			   tool parameters.'''
            self.sd = ScriptDialog(pluginHost, descriptiveName, self)
            ''' Specifying the help file will display the html help
			// file in the help pane. This file should be be located 
			// in the help directory and have the same name as the 
			// class, with an html extension.'''
            self.sd.setHelpFile(name)
            ''' Specifying the source file allows the 'view code' 
			// button on the tool dialog to be displayed.'''
            self.sd.setSourceFile(os.path.abspath(__file__))

            # add some components to the dialog '''
            self.sd.addDialogFile("Input LAS file", "Input LAS File:", "open",
                                  "LAS Files (*.las), LAS", True, False)
            self.sd.addDialogFile("Output LAS file", "Output LAS File:",
                                  "save", "LAS Files (*.las), LAS", True,
                                  False)
            self.sd.addDialogDataInput(
                "Neighbourhood search distance (xy units)",
                "Search Distance (xy units):", "10.0", True, False)
            self.sd.addDialogDataInput(
                "Maximum allowable slope between neighbouring points",
                "Max. Slope Between Points:", "45.0", True, False)
            self.sd.addDialogDataInput(
                "Minimum height above ground (z units) for an off-terrain object",
                "Min. OTO Height:", "0.15", True, False)
            self.sd.addDialogDataInput(
                "The height above ground (z units) beyond which a point is considered to be an off-terrain object regardless of inter-point slopes.",
                "Max. Height Above Ground:", "2.5", True, False)
            self.sd.addDialogDataInput(
                "Elevation (z units) below which points are excluded from analysis (Optional).",
                "Min. Elevation:", "", True, True)
            self.sd.addDialogCheckBox("Classify ground points?",
                                      "Classify ground points?", False)

            # Resize the dialog to the standard size and display it '''
            self.sd.setSize(800, 400)
            self.sd.visible = True
예제 #4
0
    def __init__(self, args):
        if len(args) != 0:
            self.execute(args)
        else:
            ''' Create a dialog for this tool to collect user-specified
			   tool parameters.'''
            self.sd = ScriptDialog(pluginHost, descriptiveName, self)
            ''' Specifying the help file will display the html help
			// file in the help pane. This file should be be located 
			// in the help directory and have the same name as the 
			// class, with an html extension.'''
            self.sd.setHelpFile(name)
            ''' Specifying the source file allows the 'view code' 
			// button on the tool dialog to be displayed.'''
            self.sd.setSourceFile(os.path.abspath(__file__))

            # add some components to the dialog '''
            self.sd.addDialogFile("Input LAS file", "Input LAS File:", "open",
                                  "LAS Files (*.las), LAS", True, False)
            self.sd.addDialogFile("Output LAS file", "Output LAS File:",
                                  "save", "LAS Files (*.las), LAS", True,
                                  False)
            self.sd.addDialogDataInput("Detrending distance (xy units)",
                                       "Detrending Distance (xy units):",
                                       "20.0", True, False)
            self.sd.addDialogDataInput(
                "Neighbourhood search distance (xy units)",
                "Search Distance (xy units):", "10.0", True, False)
            self.sd.addDialogDataInput(
                "Maximum deviation (degrees) in normal vectors",
                "Max. Normal Vector Difference:", "10.0", True, False)
            self.sd.addDialogDataInput(
                "Maximum difference in elevation (z units) between neighbouring points of the same segment",
                "Max. Elevation Difference:", "0.15", True, False)
            self.sd.addDialogCheckBox("Classify ground segments?",
                                      "Classify ground segments?", False)

            # Resize the dialog to the standard size and display it '''
            self.sd.setSize(800, 400)
            self.sd.visible = True
예제 #5
0
    def __init__(self, args):
        if len(args) != 0:
            self.execute(args)
        else:
            ''' Create a dialog for this tool to collect user-specified
			   tool parameters.'''
            self.sd = ScriptDialog(pluginHost, descriptiveName, self)
            ''' Specifying the help file will display the html help
			// file in the help pane. This file should be be located 
			// in the help directory and have the same name as the 
			// class, with an html extension.'''
            self.sd.setHelpFile(name)
            ''' Specifying the source file allows the 'view code' 
			// button on the tool dialog to be displayed.'''
            self.sd.setSourceFile(os.path.abspath(__file__))

            # add some components to the dialog '''
            self.sd.addDialogFile("Input LAS file", "Input LAS File:", "open",
                                  "LAS Files (*.las), LAS", True, False)
            self.sd.addDialogFile("Output LAS file", "Output LAS File:",
                                  "save", "LAS Files (*.las), LAS", True,
                                  False)
            self.sd.addDialogDataInput("Minimum elevation in z-units",
                                       "Minimum elevation (Optional):", "",
                                       True, True)
            self.sd.addDialogDataInput("Maximum elevation in z-units",
                                       "Maximum elevation (Optional):", "",
                                       True, True)
            self.sd.addDialogDataInput("In-slice class value (0-31)",
                                       "In-slice Class Value (Optional):", "",
                                       True, True)
            self.sd.addDialogDataInput("Out-of-slice class value (0-31)",
                                       "Out-of-slice Class Value (Optional):",
                                       "", True, True)

            # Resize the dialog to the standard size and display it '''
            self.sd.setSize(800, 400)
            self.sd.visible = True
예제 #6
0
	def __init__(self, args, descriptiveName):
		if len(args) != 0:
			''' This will be followed if the parameters have already 
			been set, e.g. if the tool was called from another script. '''
			self.execute(args)
		else:
			''' The script dialog is created here. The first parameter 
			points the dialog to the Whitebox user interface. The second 
			parameter is the title of the dialog. In most cases this should 
			be set to the descriptive name of the tool. The third parameter
			is a listener for the OK button. When the user presses OK on 
			the dialog, actionPerformed method of this class will be informed.''' 
			self.sd = ScriptDialog(pluginHost, descriptiveName, self)	
			
			''' Sets the name of the helpfile, which should be an html file 
			contained in the Help directory. Ideally, it has the same name as 
			the tool's name.'''
			helpFile = self.__class__.__name__
			self.sd.setHelpFile(helpFile)
	
			''' This next line will enable the 'View Code' button on the dialog.'''
			self.sd.setSourceFile(os.path.abspath(__file__))
	
			''' Now add some components to the dialog. The following is a 
			description of some of the most commonly used dialog components.'''
	
			''' Use the addDialogFile method to add a File input/output component 
			to the dialog. The method has six parameters: 1) String description, 
			2) String labelText, 3) String dialogMode ("open" or "save"), 
			4) String filter (commonly "Raster Files (*.dep), DEP", 
			"Vector Files (*.shp), SHP", or "Whitebox Files (*.dep; *.shp), DEP, SHP"), 
			5) boolean showButton, 6) boolean makeOptional.'''
			self.sd.addDialogFile("Input vector layer", "Input Vector Layer:", "open", "Vector Files (*.shp), SHP", False, False)
			
			''' Resize the dialog to the standard size and display it '''
			self.sd.setSize(800, 400)
			self.sd.visible = True
예제 #7
0
    def __init__(self, args):
        if len(args) != 0:
            ''' This will be followed if the parameters have already 
			been set, e.g. if the tool was called from another script. '''
            self.execute(args)
        else:
            ''' The script dialog is created here. The first parameter 
			points the dialog to the Whitebox user interface. The second 
			parameter is the title of the dialog. In most cases this should 
			be set to the descriptive name of the tool. The third parameter
			is a listener for the OK button. When the user presses OK on 
			the dialog, actionPerformed method of this class will be informed.'''
            self.sd = ScriptDialog(pluginHost, "My Script", self)
            ''' Sets the name of the helpfile, which should be an html file 
			contained in the Help directory. Ideally, it has the same name as 
			the tool's name.'''
            helpFile = self.__class__.__name__
            self.sd.setHelpFile(helpFile)
            ''' This next line will enable the 'View Code' button on the dialog.'''
            self.sd.setSourceFile(os.path.abspath(__file__))
            ''' Now add some components to the dialog. The following is a 
			description of some of the most commonly used dialog components.'''
            ''' Use the addDialogFile method to add a File input/output component 
			to the dialog. The method has six parameters: 1) String description, 
			2) String labelText, 3) String dialogMode ("open" or "save"), 
			4) String filter (commonly "Raster Files (*.dep), DEP", 
			"Vector Files (*.shp), SHP", or "Whitebox Files (*.dep; *.shp), DEP, SHP"), 
			5) boolean showButton, 6) boolean makeOptional.'''
            self.sd.addDialogFile("Input raster file", "Input Raster File:",
                                  "open", "Raster Files (*.dep), DEP", True,
                                  False)
            self.sd.addDialogFile("Output rasterfile", "Output Raster File:",
                                  "save", "Raster Files (*.dep), DEP", True,
                                  False)
            self.sd.addDialogFile("Input vector file", "Input Vector File:",
                                  "open", "Vector Files (*.shp), SHP", True,
                                  False)
            self.sd.addDialogFile("Output vector file", "Output Vector File:",
                                  "save", "Vector Files (*.shp), SHP", True,
                                  False)
            ''' Use the addDialogMultiFile method to add a multi-file selection 
			component to the dialog. This method has three parameters: 1) String description, 
			2) String labelText, 3) String filter (commonly "Raster Files (*.dep), DEP", 
			"Vector Files (*.shp), SHP", or "Whitebox Files (*.dep; *.shp), DEP, SHP")'''
            #self.sd.addDialogMultiFile("This is a multifile input", "Choose some raster files:", "Raster Files (*.dep), DEP")
            ''' Use the addDialogDataInput method to add a data input component 
			retrieving text strings or numbers from the user. This method has 
			five parameters: 1) String description, 2) String labelText,
	        3) String initialText, 4) boolean numericalInput (text strings will 
	        not be accepted), 5) boolean makeOptional.'''
            self.sd.addDialogDataInput("Enter data here", "Enter a number",
                                       "1.3", True, False)
            ''' Use the addDialogCheckBox method to add a checkbox to the dialog. 
			This method has three parameters: 1) String description, 2) String 
			labelText, 3) boolean initialState'''
            self.sd.addDialogCheckBox("Do you want it to rain?",
                                      "Will it rain?", True)
            ''' Use the addDialogComboBox method to add a drop-down selection 
			list to the dialog. This method has four parameters: 1) String 
			description, 2) String labelText, 3) String[] (or ArrayList<>) listItems, 
			4) int defaultItem'''
            #self.sd.addDialogComboBox("Weather type", "Weather type:", ["rain", "snow", "sun", "hail"], 1)
            ''' Use the addDialogOption method to add a radio-button style 
			option on the dialog. This method has four parameters: 1) String 
			description, 2) String labelText, 3) String button1String, 4) String 
			button2String'''
            #self.sd.addDialogOption("This is an option", "Choose one:", "Plants", "Animals")
            ''' Use the addDialogFieldSelector method to add a field selector component 
			to the dialog. A field selector is a combination file input, specifically 
			for selecting shapefiles, and a list selector for specifying a field 
			within the shapefile's attribute table. This method has three parameters: 
			1) String description, 2) String labelText, 3) boolean allowMultipleSelection'''
            #self.sd.addDialogFieldSelector("A field selector", "Choose a field", True)
            ''' Use the addDialogLabel method to add a label to the dialog. This 
			method has one parameter: 1) String text'''
            #self.sd.addDialogLabel("Model Parameters:")
            ''' Resize the dialog to the standard size and display it '''
            self.sd.setSize(800, 400)
            self.sd.visible = True