- Timestamp:
- 03/24/14 17:32:50 (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Plotter2.cpp
r2896 r2909 3 3 namespace asap { 4 4 5 Plotter2 AnnotationInfo::Plotter2AnnotationInfo() {5 Plotter2TextInfo::Plotter2TextInfo() { 6 6 text = ""; 7 7 posx = 0.0; … … 14 14 } 15 15 16 Plotter2 AnnotationInfo::~Plotter2AnnotationInfo() {16 Plotter2TextInfo::~Plotter2TextInfo() { 17 17 } 18 18 … … 103 103 vRect.clear(); 104 104 vArro.clear(); 105 v Anno.clear();105 vText.clear(); 106 106 107 107 labelXString = ""; … … 139 139 vRect.clear(); 140 140 vArro.clear(); 141 v Anno.clear();141 vText.clear(); 142 142 } 143 143 … … 917 917 di->lineWidth = width; 918 918 di->lineStyle = style; 919 //vi->vData[dataid].lineStyle = style;920 919 } 921 920 … … 1133 1132 } 1134 1133 1135 void Plotter2::set Annotation(const std::string& label, const float posx, const float posy, const float angle, const float fjust, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid, const int inAnnid) {1136 int vpid = inVpid; 1137 if (vpid >= (int)vInfo.size()) { 1138 exit(0); 1139 } 1140 if (vpid < 0) { 1141 vpid = vInfo.size() - 1; 1142 } 1143 if (vpid < 0) { 1144 Plotter2ViewportInfo vi; 1145 vInfo.push_back(vi); 1146 vpid = 0; 1147 } 1148 1149 Plotter2ViewportInfo* vi = &vInfo[vpid]; 1150 1151 int annotationid = in Annid;1134 void Plotter2::setText(const std::string& text, const float inPosx, const float inPosy, const float angle, const float fjust, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid, const int inTextid) { 1135 int vpid = inVpid; 1136 if (vpid >= (int)vInfo.size()) { 1137 exit(0); 1138 } 1139 if (vpid < 0) { 1140 vpid = vInfo.size() - 1; 1141 } 1142 if (vpid < 0) { 1143 Plotter2ViewportInfo vi; 1144 vInfo.push_back(vi); 1145 vpid = 0; 1146 } 1147 1148 Plotter2ViewportInfo* vi = &vInfo[vpid]; 1149 1150 int annotationid = inTextid; 1152 1151 if (annotationid < 0) { 1153 Plotter2 AnnotationInfo ai;1154 vi->v Anno.push_back(ai);1155 annotationid = vi->v Anno.size() - 1;1156 } else if (annotationid >= (int)vi->v Anno.size()) {1157 exit(0); 1158 } 1159 1160 Plotter2 AnnotationInfo* ai = &vi->vAnno[annotationid];1152 Plotter2TextInfo ti; 1153 vi->vText.push_back(ti); 1154 annotationid = vi->vText.size() - 1; 1155 } else if (annotationid >= (int)vi->vText.size()) { 1156 exit(0); 1157 } 1158 1159 Plotter2TextInfo* ti = &vi->vText[annotationid]; 1161 1160 1162 1161 std::string styleString; … … 1171 1170 } 1172 1171 1173 ai->text = styleString + label; 1174 ai->posx = posx; 1175 ai->posy = posy; 1176 ai->angle = angle; 1177 ai->fjust = fjust; 1178 ai->size = size; 1179 ai->color = color; 1180 ai->bgcolor = bgcolor; 1172 ti->text = styleString + text; 1173 1174 float posx = inPosx; 1175 if (posx < 0.0) { 1176 posx = 0.5*(vi->vpPosXMin + vi->vpPosXMax); 1177 } 1178 ti->posx = posx; 1179 1180 float posy = inPosy; 1181 if (posy < 0.0) { 1182 posy = 0.5*(vi->vpPosYMin + vi->vpPosYMax); 1183 } 1184 ti->posy = posy; 1185 1186 ti->angle = angle; 1187 ti->fjust = fjust; 1188 ti->size = size; 1189 ti->color = color; 1190 ti->bgcolor = bgcolor; 1181 1191 } 1182 1192 … … 1458 1468 } 1459 1469 1460 // a nnotations1461 for (unsigned int j = 0; j < vi.v Anno.size(); ++j) {1470 // arbitrary texts 1471 for (unsigned int j = 0; j < vi.vText.size(); ++j) { 1462 1472 resetAttributes(vi); 1463 1473 1464 Plotter2 AnnotationInfo ai = vi.vAnno[j];1465 cpgsch( ai.size);1466 cpgsci( ai.color);1467 cpgstbg( ai.bgcolor);1468 cpgptxt( ai.posx, ai.posy, ai.angle, ai.fjust, ai.text.c_str());1474 Plotter2TextInfo ti = vi.vText[j]; 1475 cpgsch(ti.size); 1476 cpgsci(ti.color); 1477 cpgstbg(ti.bgcolor); 1478 cpgptxt(ti.posx, ti.posy, ti.angle, ti.fjust, ti.text.c_str()); 1469 1479 } 1470 1480 -
trunk/src/Plotter2.h
r2896 r2909 11 11 namespace asap { 12 12 13 class Plotter2 AnnotationInfo {14 public: 15 Plotter2 AnnotationInfo();16 ~Plotter2 AnnotationInfo();13 class Plotter2TextInfo { 14 public: 15 Plotter2TextInfo(); 16 ~Plotter2TextInfo(); 17 17 18 18 std::string text; … … 140 140 141 141 //annotations 142 std::vector<Plotter2 AnnotationInfo> vAnno;142 std::vector<Plotter2TextInfo> vText; 143 143 144 144 // x-label … … 239 239 void setMaskX(const float xmin, const float xmax, const int color, const int fill, const int width, const float hsep, const int inVpid); 240 240 void setArrow(const float xtail, const float xhead, const float ytail, const float yhead, const int color, const int width, const int lineStyle, const float headSize, const int headFillStyle, const float headAngle, const float headVent, const int inVpid, const int inArrowid); 241 void set Annotation(const std::string& label, const float posx, const float posy, const float angle, const float fjust, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid, const int inAnnid);242 void setLabelX(const std::string& label, const float posx, const float posy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid);243 void setLabelY(const std::string& label, const float posx, const float posy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid);244 void setTitle(const std::string& label, const float posx, const float posy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid);241 void setText(const std::string& text, const float inPosx, const float inPosy, const float angle, const float fjust, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid, const int inTextid); 242 void setLabelX(const std::string& label, const float inPosx, const float inPosy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid); 243 void setLabelY(const std::string& label, const float inPosx, const float inPosy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid); 244 void setTitle(const std::string& label, const float inPosx, const float inPosy, const float size, const std::string& style, const int color, const int bgcolor, const int inVpid); 245 245 void setViewportBackgroundColor(const int bgcolor, const int inVpid); 246 246 void plot(); -
trunk/src/python_Plotter2.cpp
r2896 r2909 82 82 .def("set_mask_x",&Plotter2::setMaskX) 83 83 .def("set_arrow",&Plotter2::setArrow) 84 .def("set_ annotation",&Plotter2::setAnnotation)84 .def("set_text",&Plotter2::setText) 85 85 .def("set_label_x",&Plotter2::setLabelX) 86 86 .def("set_label_y",&Plotter2::setLabelY)
Note:
See TracChangeset
for help on using the changeset viewer.