# Path: geosolver/randomproblem.py
# def _constraint_group(problem, group, dependend, angleratio):
# def _round(val,roundoff):
# def random_problem_2D(numpoints, radius=10.0, roundoff=0.0, angleratio=0.5):
# def add_random_constraint(problem, ratio):
# def randomize_angles(problem):
# def randomize_hedgehogs(problem):
# def randomize_balloons(problem):
# def random_distance_problem_3D(npoints, radius, roundoff):
# def random_triangular_problem_3D(npoints, radius, roundoff, pangle):
# def test():


import preferencesDlg, decompositionView
from includes import *
from viewportManager import *
from prototypeObjects import PrototypeManager
from tools import *
from panel import *
from solutionView import *
from parameters import Settings
from geosolver import randomproblem 
from ui_randomProblemDialog import Ui_randomProblemDialog
            self.setWindowTitle("- " + title + self.tr(" - Geometric Constraint Solver"))
    
    def saveAs(self):
        saveDialog = QtGui.QFileDialog()
        saveDialog.setDefaultSuffix(".gcs")
        filename = saveDialog.getSaveFileName(self, self.tr("Save As.."), "", self.tr("GCS Files (*.gcs)"))
        
        if not filename.isEmpty():
            if not filename.endsWith(saveDialog.defaultSuffix()):
                filename.append(saveDialog.defaultSuffix())
            self.saveFileName = filename
            self.save()

    def importFile(self):
        filename = QtGui.QFileDialog.getOpenFileName(self, self.tr("Import File"), "", self.tr("GCS Files (*.gcs)"))
        if not filename.isEmpty():
            self.importCommand = ImportCommand(self)
            self.importCommand.execute(filename)

    # Rick 20090522
    def generateRandom(self):
        ## first do as if File->New was selected
        self.new()
        ## then show randomProblemDialog
        #ui = Ui_randomProblemDialog()
        #dialog = QtDialog()
        ## create random problem
        (numpoints, ratio, size, rounding) = (10, 0.0, 100.0, 0.0)
        problem = randomproblem.random_triangular_problem_3D(numpoints, size, rounding, ratio)
        prototypeManager = PrototypeManager()

# Path: geosolver/randomproblem.py
# def _constraint_group(problem, group, dependend, angleratio):
# def _round(val,roundoff):
# def random_problem_2D(numpoints, radius=10.0, roundoff=0.0, angleratio=0.5):
# def add_random_constraint(problem, ratio):
# def randomize_angles(problem):
# def randomize_hedgehogs(problem):
# def randomize_balloons(problem):
# def random_distance_problem_3D(npoints, radius, roundoff):
# def random_triangular_problem_3D(npoints, radius, roundoff, pangle):
# def test():


# Path: workbench/main.py
import preferencesDlg, decompositionView
from includes import *
from viewportManager import *
from prototypeObjects import PrototypeManager
from tools import *
from panel import *
from solutionView import *
from parameters import Settings
from geosolver import randomproblem 
from ui_randomProblemDialog import Ui_randomProblemDialog

            self.setWindowTitle("- " + title + self.tr(" - Geometric Constraint Solver"))
    
    def saveAs(self):
        saveDialog = QtGui.QFileDialog()
        saveDialog.setDefaultSuffix(".gcs")
        filename = saveDialog.getSaveFileName(self, self.tr("Save As.."), "", self.tr("GCS Files (*.gcs)"))
        
        if not filename.isEmpty():
            if not filename.endsWith(saveDialog.defaultSuffix()):
                filename.append(saveDialog.defaultSuffix())
            self.saveFileName = filename
            self.save()

    def importFile(self):
        filename = QtGui.QFileDialog.getOpenFileName(self, self.tr("Import File"), "", self.tr("GCS Files (*.gcs)"))
        if not filename.isEmpty():
            self.importCommand = ImportCommand(self)
            self.importCommand.execute(filename)

    # Rick 20090522
    def generateRandom(self):
        ## first do as if File->New was selected
        self.new()
        ## then show randomProblemDialog
        #ui = Ui_randomProblemDialog()
        #dialog = QtDialog()
        ## create random problem
        (numpoints, ratio, size, rounding) = (10, 0.0, 100.0, 0.0)
        problem = randomproblem.random_triangular_problem_3D(numpoints, size, rounding, ratio)
        prototypeManager = PrototypeManager()

        prototypeManager.setProblem(problem)