Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have problem using Orthogonal Digitizing button from CAD Tools plugin menu. It moves the first point of the polygon by holding ctrl key pressed and pressing right mouse button till the last angle is squared. Is it possible to change setting to move the last vertex till the last angle is squared?

share|improve this question

1 Answer 1

Sergey, on QGIS 1.7.4-4 on Mac 10.7.3 with CAD Tools ver. 0.5.9, I am not seeing the first vertex being moved. In fact, I notice that the last vertex (one currently under the cursor?) is being moved, as per your request.

On examining the relevant Python script...

~/.qgis/python/plugins/cadtools/tools/orthogonaldigitizer.py

@ line #91, I notice the point-moving method as using the last vertex:

def createFeature(self):

    layer = self.canvas.currentLayer() 
    provider = layer.dataProvider()
    f = QgsFeature()

    if self.isPolygon == True:
        if self.mCtrl == True:
            # we will move the first point to close the polygon square... (square??)
            # NO: move the last point!

            # the last segment 
            pn = self.rb.getPoint(0,  self.rb.numberOfVertices()-2)
            pm = self.rb.getPoint(0,  self.rb.numberOfVertices()-1)

            p1 = self.rb.getPoint(0, 0)
            p2 = self.rb.getPoint(0, 1)

            # but we need a line segment that is orthogonal to the last segment
            # der letzte Punkt ist der Aufpunkt
            # der Richtungsvektor ist der Vektor, der rechwinklig zum Differenzvektor pn-pm liegt (-> x/y vertauschen)
            d = ( (pn.x()-pm.x())**2 + (pn.y()-pm.y())**2 )**0.5
            xp = p1.x() + (p1.y()-p2.y()) 
            yp = p1.y() - (p1.x()-p2.x())  
            pp = QgsPoint(xp,  yp)

            p0 = LineIntersection.intersectionPoint(pn, pm, p1, pp)
            self.rb.movePoint(self.rb.numberOfVertices()-1, p0, 0)

Note "# NO: move the last point!" comment, and that last line contains:

numberOfVertices()-1  <-- last point in QgsRubberBand being moved

Maybe this is a newer version of CAD Tools than you are running? My version exhibits the behavior you are requesting. There does not seem to be an option -- short of editing the plugin's code -- to toggle which point gets moved.

You may want to request this feature on the CAD Tools issue tracker at QGIS.org or the one at code.google.com. Not sure which is the appropriate, since there is not one listed at the plugin's QGIS repository page.

share|improve this answer
    
Hi Dakcarto! Thanks a lot for this. Information was very useful for me. The problem was in current version of CAD Tools and it is resolved for this moment. –  Sergey May 25 '12 at 9:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.