~ubuntu-branches/debian/wheezy/latexdraw/wheezy

« back to all changes in this revision

Viewing changes to latexDraw/figures/Dot.java

  • Committer: Bazaar Package Importer
  • Author(s): Stuart Prescott
  • Date: 2009-07-15 23:35:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090715233552-2bblktyf2lmrkyo3
Tags: 2.0.3+1-1
* New upstream release.
* Add additional Recommended packages for new export features.
* Fix typo in long description, with thanks to Kai Weber (Closes: #529195).
* Bump standards to 3.8.2 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import latexDraw.ui.components.LaTeXDrawComboBox;
18
18
import latexDraw.ui.components.LabelListCellRenderer;
19
19
import latexDraw.ui.components.MagneticGrid;
 
20
import latexDraw.util.LaTeXDrawNumber;
20
21
import latexDraw.util.LaTeXDrawPoint2D;
21
22
import latexDraw.util.LaTeXDrawResources;
22
23
 
670
671
        @Override
671
672
        public String getCodePSTricks(DrawBorders drawBorders, float ppc)
672
673
        {
 
674
                double threshold = 0.001;
673
675
                LaTeXDrawPoint2D o = drawBorders.getOriginPoint();
674
676
                double x = center.x - o.x, y = o.y - center.y;
675
677
                String start = "", end = "", add = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
708
710
                        
709
711
                        if(tmpX!=0f && tmpY!=0f)
710
712
                        {
711
 
                                start = "\\rput("+tmpX/ppc+", "+ tmpY/ppc +"){";  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
 
713
                                start = "\\rput("+LaTeXDrawNumber.getCutNumber(tmpX/ppc,threshold)+", "+ LaTeXDrawNumber.getCutNumber(tmpY/ppc,threshold) +"){";  //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
712
714
                                end = "}"; //$NON-NLS-1$
713
715
                        }
714
716
                }
716
718
                if(!currentStyle.equals(PSTricksConstants.DOT_STYLE))
717
719
                        add +=",dotstyle="+currentStyle; //$NON-NLS-1$
718
720
                
719
 
                return start + "\\psdots[dotsize=" +  (width/ppc) + add  //$NON-NLS-1$
720
 
                                + "](" + (float)(x/ppc) + ',' + (float)(y/ppc) + ')' + end;//$NON-NLS-1$
 
721
                return start + "\\psdots[dotsize=" +  LaTeXDrawNumber.getCutNumber(width/ppc,threshold) + add  //$NON-NLS-1$
 
722
                                + "](" + LaTeXDrawNumber.getCutNumber((float)(x/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)(y/ppc),threshold) + ')' + end;//$NON-NLS-1$
721
723
        }
722
724
 
723
725