~ubuntu-branches/debian/sid/latexdraw/sid

« back to all changes in this revision

Viewing changes to latexDraw/figures/Rhombus.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:
16
16
import latexDraw.ui.LaTeXDrawFrame;
17
17
import latexDraw.ui.components.Delimitor;
18
18
import latexDraw.ui.components.MagneticGrid;
 
19
import latexDraw.util.LaTeXDrawNumber;
19
20
import latexDraw.util.LaTeXDrawPoint2D;
20
21
 
21
22
 
394
395
                double Xcenter = (pt1.x+pt2.x)/2. - d.x, Ycenter = d.y - (pt1.y+pt3.y)/2.;
395
396
                String add="", fillType=""; //$NON-NLS-1$ //$NON-NLS-2$
396
397
                boolean isFilledWasChanged = false;
 
398
                double threshold = 0.0001;
397
399
                
398
400
                if(hasShadow)
399
401
                {
402
404
                                fillType+=",shadowangle="+(float)(Math.toDegrees(shadowAngle)-Math.toDegrees(rotationAngle));//$NON-NLS-1$
403
405
                        
404
406
                        if(((float)shadowSize)!=((float)DEFAULT_SHADOW_SIZE))
405
 
                                fillType+=",shadowsize="+(float)(shadowSize/PPC);//$NON-NLS-1$
 
407
                                fillType+=",shadowsize="+LaTeXDrawNumber.getCutNumber((float)(shadowSize/PPC),threshold);//$NON-NLS-1$
406
408
                        
407
409
                        if(!shadowColor.equals(PSTricksConstants.DEFAULT_SHADOW_COLOR))
408
410
                        {
431
433
                
432
434
                if(hasDoubleBoundary)
433
435
                {
434
 
                        add+=",doubleline=true,doublesep="+(float)(doubleSep/ppc); //$NON-NLS-1$
 
436
                        add+=",doubleline=true,doublesep="+LaTeXDrawNumber.getCutNumber((float)(doubleSep/ppc),threshold); //$NON-NLS-1$
435
437
                        
436
438
                        if(doubleColor!=PSTricksConstants.DEFAULT_DOUBLE_COLOR)
437
439
                        {
448
450
                if(rotationAngle%(Math.PI*2)!=0)
449
451
                        add+=",gangle="+(float)Math.toDegrees(-rotationAngle);//$NON-NLS-1$
450
452
                
451
 
                if(Math.abs(Xcenter) < 0.001) Xcenter = 0;
452
 
                if(Math.abs(Ycenter) < 0.001) Ycenter = 0;
453
453
                if(isFilledWasChanged) isFilled = false;
454
454
                
455
 
                return "\\psdiamond[linewidth=" + (thickness/ppc) +  //$NON-NLS-1$
456
 
                add + fillType + "](" + (float)(Xcenter/ppc) + ',' +  //$NON-NLS-1$
457
 
                (float)(Ycenter/ppc) + ")("  //$NON-NLS-1$
458
 
                        + (float)((Math.abs(pt1.x-pt2.x)/2.)/ppc) + ',' + (float)((Math.abs(pt1.y-pt3.y)/2.)/ppc) + ')';
 
455
                return "\\psdiamond[linewidth=" + LaTeXDrawNumber.getCutNumber((thickness/ppc),threshold) +  //$NON-NLS-1$
 
456
                add + fillType + "](" + LaTeXDrawNumber.getCutNumber((float)(Xcenter/ppc),threshold) + ',' +  //$NON-NLS-1$
 
457
                LaTeXDrawNumber.getCutNumber((float)(Ycenter/ppc),threshold) + ")("  //$NON-NLS-1$
 
458
                        + LaTeXDrawNumber.getCutNumber((float)((Math.abs(pt1.x-pt2.x)/2.)/ppc),threshold) + ',' + LaTeXDrawNumber.getCutNumber((float)((Math.abs(pt1.y-pt3.y)/2.)/ppc),threshold) + ')';
459
459
        }
460
460
        
461
461
        
965
965
        public String getPSTricksCodeFilling(float ppc)
966
966
        {
967
967
                String str="fillstyle=";//$NON-NLS-1$
968
 
 
 
968
                double threshold = 0.001;
 
969
                
969
970
                if(hatchingStyle.equals(PSTricksConstants.TOKEN_FILL_NONE))
970
971
                {
971
972
                        if(isFilled)
1018
1019
                                if(isFilled)
1019
1020
                                        str += "*"; //$NON-NLS-1$
1020
1021
        
1021
 
                                str += ",hatchwidth=" + (hatchingWidth / PPC) + ",hatchangle=" + //$NON-NLS-1$ //$NON-NLS-2$
 
1022
                                str += ",hatchwidth=" + LaTeXDrawNumber.getCutNumber(hatchingWidth/PPC,threshold) + ",hatchangle=" + //$NON-NLS-1$ //$NON-NLS-2$
1022
1023
                                                (float)((-Math.toDegrees(rotationAngle))%360.);
1023
1024
                                //TODO hatching angle
1024
1025
                                if(!hatchingColor.equals(PSTricksConstants.DEFAULT_HATCHING_COLOR))