Changeset 1887 in Sophya
- Timestamp:
- Jan 30, 2002, 5:44:39 PM (24 years ago)
- Location:
- trunk/SophyaPI/PI
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pidrawer.cc
r1884 r1887 559 559 560 560 if (mFSz == PI_NotDefFontSize) 561 g->SelFontSz(xMajTickLen* 3., mFAtt);561 g->SelFontSz(xMajTickLen*4., mFAtt); // Passage de x3. a x4. - Reza Janvier 2002 562 562 563 563 // Choix du bon format pour les labels des axes; … … 590 590 591 591 if (mFSz == PI_NotDefFontSize) 592 g->SelFontSz(xMajTickLen* 3., mFAtt);592 g->SelFontSz(xMajTickLen*4., mFAtt); // Passage de x3. a x4. - Reza Janvier 2002 593 593 594 594 // Choix du bon format pour les labels des axes; -
trunk/SophyaPI/PI/pidrwtools.cc
r1877 r1887 227 227 mOpt[5]->AppendItem("Dotted-Line", 608); 228 228 mOpt[5]->AppendItem("ThickDotted", 609); 229 mOpt[5]->AppendItem("ThinDashDott", 610); 230 mOpt[5]->AppendItem("DashDot-Line", 611); 231 mOpt[5]->AppendItem("ThickDashDott", 612); 229 232 mOpt[5]->SetValue(600); 230 233 mOpt[5]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); … … 335 338 PI_TriangleMarker, PI_FTriangleMarker, 336 339 PI_StarMarker, PI_FStarMarker }; 337 static PILine Att line[10] = { PI_NotDefLineAtt, PI_ThinLine, PI_NormalLine, PI_ThickLine,340 static PILineTypes line[13] = { PI_NotDefLineAtt, PI_ThinLine, PI_NormalLine, PI_ThickLine, 338 341 PI_ThinDashedLine, PI_DashedLine, PI_ThickDashedLine, 342 PI_ThinDashDottedLine, PI_DashDottedLine, PI_ThickDashDottedLine, 339 343 PI_ThinDottedLine, PI_DottedLine, PI_ThickDottedLine }; 340 344 … … 467 471 468 472 PILineAtt lat = dr->GetLineAtt(); 469 for(kk=0; kk<1 0; kk++)473 for(kk=0; kk<13; kk++) 470 474 if (lat == line[kk]) { mOpt[5]->SetValue(600+kk); break; } 471 475 … … 502 506 503 507 k = mOpt[5]->GetValue()-600; 504 if ( (k < 0) || (k > 9) ) k = 0;505 drw->SetLineAtt( line[k]);508 if ( (k < 0) || (k > 12) ) k = 0; 509 drw->SetLineAtt(PILineAtt(line[k])); 506 510 if (fgref) mCurBW->Refresh(); 507 511 else drw->Refresh(); -
trunk/SophyaPI/PI/pigraphgen.cc
r1886 r1887 14 14 15 15 /* --Methode-- */ 16 PILineAtt::PILineAtt(PILineTyp ltyp) 17 { 16 PILineAtt::PILineAtt(PILineTypes ltyp) 17 { 18 _lwidth = 2*8; 19 _ldash=PI_LineSolid; 18 20 _ljoincap = PI_JoinMiter*PI_CapButt*256; 19 21 switch (ltyp) { … … 47 49 case PI_ThickDottedLine : 48 50 _lwidth = 8*4; _ldash=PI_LineDotted; 51 break; 52 case PI_DashDottedLine : 53 _lwidth = 2*8; _ldash=PI_LineDashDotted; 54 break; 55 case PI_ThinDashDottedLine : 56 _lwidth = 8; _ldash=PI_LineDashDotted; 57 break; 58 case PI_ThickDashDottedLine : 59 _lwidth = 8*4; _ldash=PI_LineDashDotted; 49 60 break; 50 61 default : -
trunk/SophyaPI/PI/pigraphgen.h
r1886 r1887 19 19 enum PILineCap { PI_CapButt=0, PI_CapRound=1, PI_CapProjecting=2}; 20 20 enum PILineDash { PI_LineSolid, PI_LineDashed, PI_LineDotted, 21 PI_LineDash edDotted};21 PI_LineDashDotted}; 22 22 // Predefined line types 23 enum PILineTyp { PI_NotDefLineAtt = -1, 24 PI_NormalLine, PI_ThinLine, PI_ThickLine, 25 PI_DashedLine, PI_ThinDashedLine, PI_ThickDashedLine, 26 PI_DottedLine, PI_ThinDottedLine, PI_ThickDottedLine }; 23 enum PILineTypes { PI_NotDefLineAtt, 24 PI_NormalLine, PI_ThinLine, PI_ThickLine, 25 PI_DashedLine, PI_ThinDashedLine, PI_ThickDashedLine, 26 PI_DottedLine, PI_ThinDottedLine, PI_ThickDottedLine, 27 PI_DashDottedLine, PI_ThinDashDottedLine, PI_ThickDashDottedLine}; 27 28 28 29 // Marker types … … 80 81 class PILineAtt { 81 82 public: 82 inline PILineAtt(int width=1, PILineDash dash=PI_LineSolid,83 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt)84 { _lwidth = width*8; _ldash=dash; _ljoincap=join+cap*256; }85 inline PILineAtt(double width, PILineDash dash=PI_LineSolid,86 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt)87 { _lwidth = ( unsigned short)(width*8.); _ldash=dash; _ljoincap=join+cap*256; }83 explicit inline PILineAtt(int width=1, PILineDash dash=PI_LineSolid, 84 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt) 85 {_lwidth = (width>0)?width*8:8; _ldash=dash; _ljoincap=join+cap*256; } 86 explicit inline PILineAtt(double width, PILineDash dash=PI_LineSolid, 87 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt) 88 { _lwidth = (width>0)?(unsigned short)(width*8.):8; _ldash=dash; _ljoincap=join+cap*256; } 88 89 inline PILineAtt(PILineAtt const& b) 89 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; } 90 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; } 90 91 91 PILineAtt(PILineTypltyp);92 explicit PILineAtt(PILineTypes ltyp); 92 93 93 94 inline ~PILineAtt() {} 94 95 95 96 inline PILineAtt& operator = (PILineAtt const& b) 96 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; return(*this); } 97 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; return(*this); } 98 inline PILineAtt& operator = (PILineTypes ltyp) 99 { *this=PILineAtt(ltyp); return(*this); } 100 97 101 inline bool operator == (PILineAtt const& b) 98 102 { return ((_lwidth==b._lwidth)&&(_ldash==b._ldash)&&(_ljoincap==b._ljoincap)); } 99 inline bool operator == (PILineTyp ltyp)103 inline bool operator == (PILineTypes ltyp) 100 104 { return ((*this) == PILineAtt(ltyp)); } 101 105 inline bool operator != (PILineAtt const& b) 102 { return ( !(_lwidth==b._lwidth)&&(_ldash==b._ldash)&&(_ljoincap==b._ljoincap)); }103 inline bool operator != (PILineTyp ltyp)106 { return ((_lwidth!=b._lwidth)||(_ldash!=b._ldash)||(_ljoincap!=b._ljoincap)); } 107 inline bool operator != (PILineTypes ltyp) 104 108 { return ((*this) != PILineAtt(ltyp)); } 105 109 106 inline int GetLineWidth() const { return ( _lwidth/8); }110 inline int GetLineWidth() const { return ((_lwidth>0)?_lwidth/8:1); } 107 111 inline int GetLineWidthx8() const { return (_lwidth); } 108 inline double GetLineWidthD() const { return (( double)_lwidth/8.); }112 inline double GetLineWidthD() const { return ((_lwidth>0)?(double)_lwidth/8.:1.); } 109 113 inline PILineDash GetLineDash() const { return _ldash; } 110 114 inline PILineJoin GetLineJoin() const { return (PILineJoin)(_ljoincap%256); } … … 180 184 virtual void SelGOMode(PIGOMode mod=PI_GOCopy) = 0; 181 185 virtual void SelLine(PILineAtt att=PI_NormalLine) = 0; 182 inline void SelLine(PILineTyp lt) { SelLine(PILineAtt(lt)); }186 inline void SelLine(PILineTypes lt) { SelLine(PILineAtt(lt)); } 183 187 virtual void SelMarker(int msz=3, PIMarker mrk=PI_DotMarker) = 0; 184 188 virtual void SelArrowMarker(int arrsz=5, -
trunk/SophyaPI/PI/pigraphps.cc
r1851 r1887 413 413 414 414 /* --Methode-- */ 415 void PIGraphicPS::SetClipRectangle(PIGrCoord /*x0*/, PIGrCoord /*y0*/, PIGrCoord /*dx*/, PIGrCoord /*dy*/) 416 { 417 /* $CHECK$ A FAIRE , voir Nicolas */ 418 return; 415 void PIGraphicPS::SetClipRectangle(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) 416 { 417 mPSOut->SetClipRectangle((double)x0, (double)y0, (double)dx, (double)dy); 419 418 } 420 419 … … 422 421 void PIGraphicPS::ClearClipRectangle() 423 422 { 424 /* $CHECK$ A FAIRE , voir Nicolas */ 425 return; 423 mPSOut->ClearClipRectangle(); 426 424 } 427 425 -
trunk/SophyaPI/PI/pigraphuc.cc
r587 r1887 410 410 411 411 /* --Methode-- */ 412 void PIGraphicUC::DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 413 const char* s_up, const char* s_dn, int pos) 414 { 415 if (!mGrC) return; 416 double xf, yf; 417 UC2GrC(x, y, xf, yf); 418 mGrC->DrawCompString(xf, yf, s, s_up, s_dn, pos); 419 } 420 421 /* --Methode-- */ 412 422 void PIGraphicUC::DrawLine(PIGrCoord xc1, PIGrCoord yc1, PIGrCoord xc2, PIGrCoord yc2) 413 423 { … … 683 693 684 694 /* --Methode-- */ 695 void PIGraphicUC::DrawArrowMarker(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) 696 { 697 if (!mGrC) return; 698 double xf1, yf1, xf2, yf2; 699 UC2GrC(x1, y1, xf1, yf1); 700 UC2GrC(x2, y2, xf2, yf2); 701 mGrC->DrawArrowMarker(xf1, yf1, xf2, yf2); 702 } 703 704 /* --Methode-- */ 685 705 void PIGraphicUC::DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 686 706 int sx, int sy, PIColorMap* cmap) -
trunk/SophyaPI/PI/pigraphuc.h
r535 r1887 45 45 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 46 46 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0); 47 virtual void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 48 const char* s_up, const char* s_dn, int pos = 0); 47 49 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 48 50 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy); … … 61 63 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0); 62 64 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n); 65 virtual void DrawArrowMarker(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 66 63 67 virtual void DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 64 68 int sx, int sy, PIColorMap* cmap); -
trunk/SophyaPI/PI/pigraphx.cc
r1886 r1887 66 66 SelForeground(PI_Black); 67 67 SelBackground(PI_White); 68 mLAtt = PI_ ThinLine;68 mLAtt = PI_NotDefLineAtt; 69 69 XSetFont(mDisp, DefGC(), myFont.GetXFontId()); // Pour initialiser la fonte ds le GC 70 70 SelLine(); … … 482 482 483 483 switch (att.GetLineDash()) { 484 case PI_LineSolid : 485 lstyle = LineSolid; 486 break; 487 case PI_LineDashed : 488 lstyle = LineOnOffDash; 489 dash[0] = dash[1] = 6; 490 dashlen = 2; 491 break; 492 case PI_LineDotted : 493 lstyle = LineOnOffDash; 494 dash[0] = 2; dash[1] = 6; 495 dashlen = 2; 496 break; 497 case PI_LineDashedDotted : 498 lstyle = LineOnOffDash; 499 dash[0] = 2; dash[1] = 6; 500 dash[2] = 6; dash[1] = 6; 501 dashlen = 4; 502 break; 503 default : 504 lstyle = LineSolid; 505 break; 506 } 484 case PI_LineSolid : 485 lstyle = LineSolid; 486 break; 487 case PI_LineDashed : 488 lstyle = LineOnOffDash; 489 dash[0] = dash[1] = 6; 490 dashlen = 2; 491 break; 492 case PI_LineDotted : 493 lstyle = LineOnOffDash; 494 dash[0] = 2; dash[1] = 6; 495 dashlen = 2; 496 break; 497 case PI_LineDashDotted : 498 lstyle = LineOnOffDash; 499 dash[0] = 2; dash[1] = 2; 500 dash[2] = 4; dash[3] = 6; 501 dashlen = 4; 502 break; 503 default : 504 lstyle = LineSolid; 505 break; 506 } 507 if (lstyle != LineSolid) 508 XSetDashes( mDisp, DefGC(), 0, dash, dashlen); 509 507 510 508 511 int ljoin = JoinMiter; … … 538 541 } 539 542 540 if (lstyle != LineSolid)541 XSetDashes( mDisp, DefGC(), 0, dash, dashlen);542 543 543 XSetLineAttributes(mDisp, DefGC(), lw, lstyle, lcap, ljoin); 544 544 mLAtt = att; -
trunk/SophyaPI/PI/piversion.h
r1879 r1887 2 2 #define PIVERSION_H_SEEN 3 3 4 #define PI_VERSIONNUMBER 3.4 04 #define PI_VERSIONNUMBER 3.44 5 5 6 6 #endif -
trunk/SophyaPI/PI/psfile.cc
r1886 r1887 133 133 /sldash {[6 6] 0 setdash} bind def %% Dashed-Line \n\ 134 134 /sldott {[2 6] 0 setdash} bind def %% Dotted-Line \n\ 135 /sldashdott {[2 6 66] 0 setdash} bind def %% Dash-Dotted-Line \n\135 /sldashdott {[2 2 4 6] 0 setdash} bind def %% Dash-Dotted-Line \n\ 136 136 /ff {findfont} bind def /sf {setfont} bind def /scf {scalefont} bind def\n\ 137 137 /rl {rlineto} bind def /tr {translate} bind def\n\ … … 798 798 currentBloc->Tx, currentBloc->Ty, 799 799 currentBloc->X0, currentBloc->Y0); 800 // On redefinit la zone de clip 801 fprintf(mPSFile, "%% Define clip region to the entire bloc area \n"); 802 fprintf(mPSFile, "initclip newpath 0 0 m %.2f Ux 0 rl 0 %.2f Uy rl %2f Ux 0 rl closepath clip \n", 803 currentBloc->Dx, currentBloc->Dy, -currentBloc->Dx); 800 804 // On redefint la fonte par defaut - $CHECK$ Reza 11/12/99 801 805 mFontAtt = PI_RomanFont; … … 804 808 double scaledFontSize = (double)mFontSize*currentPage->FontScaleFactor; 805 809 fprintf(mPSFile, "/Courier ff %g FS /curfntsz %g def \n", 806 scaledFontSize, scaledFontSize) ; 810 scaledFontSize, scaledFontSize) ; 811 mLineAtt = PI_NotDefLineAtt; 812 SelectLine(PILineAtt(PI_NormalLine)); 807 813 setFontDone = true; 808 814 currentBloc->tmp = ftell(mPSFile) ; … … 830 836 /* Flags */ 831 837 currentBloc = NULL ; 838 } 839 840 841 void PSFile::SetClipRectangle(double x0, double y0, double dx, double dy) 842 { 843 // On redefinit la zone de clip 844 fprintf(mPSFile, "%% SetClipRectangle: Define clip region \n "); 845 fprintf(mPSFile, "newpath %.2f Ux %.2f Uy m %.2f Ux 0 rl 0 %.2f Uy rl %.2f Ux 0 rl closepath clip \n", 846 x0, y0, dx, dy, -dx); 847 } 848 849 void PSFile::ClearClipRectangle() 850 { 851 // On redefinit la zone de clip a l'ensemble du bloc 852 fprintf(mPSFile, "%% Define clip region to the entire bloc area \n"); 853 fprintf(mPSFile, "initclip newpath 0 0 m %.2f Ux 0 rl 0 %.2f Uy rl %2f Ux 0 rl closepath clip \n", 854 currentBloc->Dx, currentBloc->Dy, -currentBloc->Dx); 832 855 } 833 856 … … 1150 1173 if (MrkType != PI_NotDefMarker) 1151 1174 mMarker = MrkType; 1152 1175 if ((MrkType == PI_DotMarker) && (MarkerSize<3)) MarkerSize=3; 1153 1176 if(MarkerSize != mMarkerSize || setFontDone) { 1154 1177 mMarkerSize = MarkerSize ; … … 1234 1257 { 1235 1258 1236 fprintf(mPSFile, "%d slw ", att.GetLineWidth()) ; 1259 // if (att.GetLineWidth() != mLineAtt.GetLineWidth()) { 1260 double scaledLineWidth = att.GetLineWidthD()*currentPage->FontScaleFactor; 1261 fprintf(mPSFile, "%g slw ", scaledLineWidth) ; 1262 if (att.GetLineDash() != mLineAtt.GetLineDash()) { 1237 1263 switch (att.GetLineDash()) { 1238 1264 case PI_LineSolid : … … 1245 1271 fprintf(mPSFile, "sldott "); 1246 1272 break; 1247 case PI_LineDash edDotted :1273 case PI_LineDashDotted : 1248 1274 fprintf(mPSFile, "sldashdott "); 1249 1275 break; … … 1252 1278 break; 1253 1279 } 1254 1280 } 1281 if (att.GetLineJoin() != mLineAtt.GetLineJoin()) { 1255 1282 switch (att.GetLineJoin()) { 1256 1283 case PI_JoinMiter : … … 1267 1294 break; 1268 1295 } 1269 1296 } 1297 if (att.GetLineCap() != mLineAtt.GetLineCap()) { 1270 1298 switch (att.GetLineCap()) { 1271 1299 case PI_CapButt : … … 1282 1310 break; 1283 1311 } 1312 } 1284 1313 mLineAtt = att; 1285 1314 } -
trunk/SophyaPI/PI/psfile.h
r1886 r1887 104 104 virtual void EndBloc(); 105 105 106 virtual void SetClipRectangle(double x0, double y0, double dx, double dy); 107 virtual void ClearClipRectangle(); 108 106 109 virtual void SelForeground(PIColorMap& cmap, int cid) ; 107 110 virtual void SelBackground(PIColorMap& cmap, int cid) ;
Note:
See TracChangeset
for help on using the changeset viewer.