Index: RamDebugger.tcl ================================================================== --- RamDebugger.tcl +++ RamDebugger.tcl @@ -8937,10 +8937,32 @@ flush $socket puts $socket "$cmd2\n\r\n" flush $socket close $socket } + +proc RamDebugger::save_svg { svgfile xml } { + + file mkdir [file dirname $svgfile] + + set write 1 + if { [file exists $svgfile] } { + set fin [open $svgfile r] + set data [read $fin] + fconfigure $fin -encoding utf-8 + close $fin + if { $data eq $xml } { + set write 0 + } + } + if { $write } { + set fout [open $svgfile w] + fconfigure $fout -encoding utf-8 + puts -nonewline $fout $xml + close $fout + } +} proc RamDebugger::process0_markdown { args } { set optional { { -only_around_line_num number "" } @@ -9114,10 +9136,11 @@ set new_app 0 if { $new_app } { RamDebugger::Instrumenter::TryLoadLibrary set svg [svgml_evaluate svg $txt] + save_svg $svgfile $svg } else { svgml::create_file -file $svgfile $txt } lappend svgFiles $svgfile set lines [lreplace $lines $i $j] @@ -9563,10 +9586,11 @@ db_sqlite eval { create table if not exists formulas(name primary key,data) } } set data [db_sqlite onecolumn { select data from formulas where name=$formula }] if { $data eq "" } { package require tls + package require http http::register https 443 ::tls::socket set url "https://latex.codecogs.com/png.latex?[http::formatQuery $formula]" set h [http::geturl $url] set data [http::data $h] http::cleanup $h Index: scripts/markdown.cc ================================================================== --- scripts/markdown.cc +++ scripts/markdown.cc @@ -31,11 +31,11 @@ //################################################################################ // exceptions //################################################################################ typedef enum class EXP { - undefined,needs_recalculate + undefined,needs_recalculate,try_again } MarkdownExceptions; class MarkdownException { public: @@ -245,20 +245,20 @@ } void append_tspans(double x,MyTSchar& label,MyTSchar& out) { label.regsub(0,"[ \t]+"," "); - label.regsub(0,"[ \t]*\n[ \t]*","\n"); + label.regsub(0,"[ \t]*(\n|\\\\n)[ \t]*","\n"); MyTSvec splits; split_text(label,splits); for(int i=0;iexists(name.v())){ + SvgmlProperties prop=SvgmlProperties(Svgml::propNames_->get(name.v())); + if(properties_.exists(ggclong(prop))){ + value=properties_.getF_L(ggclong(prop)).value_; + } + } + contents.printE("%s:%s;",name.v(),value.v()); + } + contents_=contents; +} const int point_to_axes_g_[8][3]={{0,0,0},{1,0,0},{1,1,0},{0,1,0},{0,0,1},{1,0,1},{1,1,1},{0,1,1}}; const int face_to_points_g_[6][4]={{0,1,2,3},{0,4,5,1},{1,2,6,5},{3,7,6,2},{0,3,7,4},{4,5,6,7}}; const int ariste_to_point_g_[12][2]={{0,1},{1,2},{3,2},{0,3},{0,4},{1,5},{2,6},{3,7},{4,5},{5,6},{7,6},{4,7}}; const int face_to_normal_g_[6]={2,1,0,1,0,2}; const int face_to_normal_prev_next_g_[6]={0,0,1,1,0,1}; -void SvgmlEntity::calc_rotation_and_size(dquat& rotation_vector,double& width,double& height) +void SvgmlEntity::calc_rotation_and_size(dquat& rotation_vector,double& width,double& height,double& cube_height) { double angles[2]; MyTScharList list; MyTSchar mA[2]; @@ -2461,51 +2481,54 @@ } else { angles[0]=angles[1]=45.0*DEGTORAD; } double angleXY=angles[0]+90*DEGTORAD; double angleZ=-1.0*(angles[1]-90*DEGTORAD); - dquat a=angleAxis(RADTODEG*angleXY,dvec3(0,0,1)); - dquat newaxis=angleAxis(RADTODEG*angleZ,dvec3(1,0,0)); + dquat a=angleAxis(angleXY,dvec3(0,0,1)); + dquat newaxis=angleAxis(angleZ,dvec3(1,0,0)); rotation_vector=normalize(cross(a,newaxis)); width=bbox_[2]; + height=bbox_[3]; SvgmlPoint* whPoint=give_point(TP::width_height); if(whPoint){ - height=whPoint->pointG_[1]; + cube_height=whPoint->pointG_[2]; } else { - height=bbox_[3]; + cube_height=bbox_[3]; } } void SvgmlEntity::process_cube(SvgmlPointsConnections label,MyTSchar& style, MyTSchar& out,Svgml& svgml) { - double width,height; + double width,height,cube_height; dquat rotation_vector; - this->calc_rotation_and_size(rotation_vector,width,height); + this->calc_rotation_and_size(rotation_vector,width,height,cube_height); dvec3 p0(bbox_[0]+0.5*width,bbox_[1]+0.5*height,0); if(svgml.otype_==OTS::svg){ - for(int idx_face=0;idx_face<6;idx_face++){ + const int faces[]={0,1,4,2,3,5}; + for(int i_face=0;i_face<6;i_face++){ + int idx_face=faces[i_face]; MyTSchar ds; for(int i=0;i<4;i++){ int idx_point=face_to_points_g_[idx_face][i]; dvec3 xL( (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height + point_to_axes_g_[idx_point][2]*cube_height ); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; dvec3 pnt=p0+v; if(ds.num()==0){ - ds.printE("M%.3g,%,3g",pnt[0],pnt[1]); + ds.printE("M%.3g,%.3g",pnt[0],pnt[1]); } else { - ds.printE(" L%.3g,%,3g",pnt[0],pnt[1]); + ds.printE(" L%.3g,%.3g",pnt[0],pnt[1]); } } ds.printE(" z"); out.printE("\n",ds.v(),id_.v(),idx_face,style.v()); } @@ -2519,11 +2542,11 @@ for(int i=0;i<4;i++){ int idx_point=face_to_points_g_[idx_face][i]; dvec3 xL( (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height + point_to_axes_g_[idx_point][2]*cube_height ); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; dvec3 pnt=p0+v; center_face+=0.25*pnt; @@ -2538,11 +2561,11 @@ for(int i=0;i<2;i++){ int idx_point=ariste_to_point_g_[idx_ariste][i]; dvec3 xL( (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height + point_to_axes_g_[idx_point][2]*cube_height ); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; dvec3 pnt=p0+v; center_ariste+=0.5*pnt; @@ -2554,11 +2577,11 @@ if(label==TPC::vertex || label==TPC::all){ for(int idx_point=0;idx_point<8;idx_point++){ dvec3 xL( (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height + point_to_axes_g_[idx_point][2]*cube_height ); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; dvec3 pnt=p0+v; out.printE("%d\n",pnt[0], @@ -2568,26 +2591,27 @@ } void SvgmlEntity::calculate_connection_point_cube(SvgmlPointsConnections point_conexion, int point_conexionN,int ncoords,glm::dvec3& point) { - double width,height; + double width,height,cube_height; dquat rotation_vector; dvec3 face_pnts[4]; - this->calc_rotation_and_size(rotation_vector,width,height); + this->calc_rotation_and_size(rotation_vector,width,height,cube_height); dvec3 params=point/100.0; dvec3 p0(bbox_[0]+0.5*width,bbox_[1]+0.5*height,0); if(point_conexion==TPC::face){ int idx_face=point_conexionN-1; for(int i=0;i<4;i++){ int idx_point=face_to_points_g_[idx_face][i]; - dvec3 xL((-1+2*point_to_axes_g_[idx_point][0])*0.5*width, + dvec3 xL( + (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height); + point_to_axes_g_[idx_point][2]*cube_height); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; face_pnts[i]=p0+v; } dvec3 normal=triangleNormal(face_pnts[0],face_pnts[1],face_pnts[2]); @@ -2598,28 +2622,36 @@ dvec3 dy=params[1]*(face_pnts[3]-face_pnts[0]); dvec3 dz=params[2]*normal; point=face_pnts[0]+dx+dy+dz; } else if(point_conexion==TPC::vertex){ int idx_point=point_conexionN-1; - dvec3 xL((-1*2*point_to_axes_g_[idx_point][0])*0.5*width, - (-1*2*point_to_axes_g_[idx_point][1])*0.5*height, - point_to_axes_g_[idx_point][2]*height); + dvec3 xL( + (-1+2*point_to_axes_g_[idx_point][0])*0.5*width, + (-1+2*point_to_axes_g_[idx_point][1])*0.5*height, + point_to_axes_g_[idx_point][2]*cube_height); dvec3 v=transpose(toMat3(rotation_vector))*xL; v[1]*=-1; point=p0+v; } else { throw MyTSchar("cube,ariste not implemented yet; line='%s'",line_.v()); } } void SvgmlEntity::calculate_connection_point(SvgmlPointsConnections point_conexion, - int point_conexionN,int is_normal,int ncoords,glm::dvec3& point) + int point_conexionN,int is_normal,int ncoords,glm::dvec3& point,Svgml& svgml) { if(!is_calculated_){ throw MarkdownException(EXP::needs_recalculate); } + if(cmd_==OC::copy){ + MyTSchar id("%s.__1__%s",id_.v(),id_parent_.v()); + SvgmlEntity* parent=svgml.give_entity(id.v()); + parent->calculate_connection_point(point_conexion,point_conexionN,is_normal, + ncoords,point,svgml); + return; + } if(cmd_==OC::cube){ this->calculate_connection_point_cube(point_conexion,point_conexionN,ncoords,point); return; } if(point_conexion==TPC::face){ @@ -2748,11 +2780,11 @@ if(!is_point(points_[ipoint].ptype_)) continue; contents.print0("point:#__ROOT,%.3g,%.3g,#__ROOT,%.3g,%.3g;", points_prev[ipoint].pointG_[0],points_prev[ipoint].pointG_[1], points_[ipoint].pointG_[0],points_[ipoint].pointG_[1]); if(copy_info.connect_class_.num()){ - contents.printE(" class=%s;",copy_info.connect_class_.v()); + contents.printE(" class:%s;",copy_info.connect_class_.v()); } MyTSchar id("%s.__CT__%d",copy_info.entity_->id_.v(),ipoint); svgml.entities_.incr_num().set(id.v(),id.num(),OC::line,contents.v(),contents.num(),NULL,-1); } } else if(strcmp(copy_info.connect_.v(),"lines")==0){ @@ -2824,10 +2856,12 @@ id_parent=svgml.give_entity(id_parent_.v()); if(!id_parent){ throw MyTSchar("Entity '%s' does not have valid parent. line='%s'",id_.v(),line_.v()); } + + points_.clear(); for(int i=0;icalculate_connection_point(connectionP,connectionN,is_normal,icoord,point); + id_parentList[0]->calculate_connection_point(connectionP,connectionN, + is_normal,icoord,point,svgml); points_[end_MTS].point_=points_[end_MTS].pointG_=point; } else { if(icoord<2 || (icoord==2 && next_is_number_last)){ continue; } @@ -3064,66 +3099,75 @@ } void SvgmlEntity::create(MyTSchar& out,Svgml& svgml,Svgml_copy* copy_info) { MyTSchar mAT[3]; - if(is_calculated_) return; - - this->calculate_points(svgml,copy_info); - if(copy_info){ - this->copy_operation(svgml,*copy_info); - } - dvec3 anchor=this->give_anchor_axes(); - - int is_copy=0,is_init=0; - dvec4 bbox_copy; - dvec4& bbox=(is_copy)?bbox_copy:bbox_; - for(int i=0;i=0;j--){ - if(is_point(points_[j].ptype_)){ - break; - } - } - if(j>=0){ - dvec3 point=points_[j].pointG_-0.5*points_[i].point_; - if(!is_init){ - this->set_bbox(bbox,point); - is_init=1; - } else { + if(!is_calculated_){ + this->calculate_points(svgml,copy_info); + if(copy_info){ + this->copy_operation(svgml,*copy_info); + } + int is_init=(copy_info)?copy_info->init_bbox_:0; + dvec4& bbox=(copy_info)?copy_info->entity_->bbox_:bbox_; + + for(int i=0;i=0;j--){ + if(is_point(points_[j].ptype_)){ + break; + } + } + if(j>=0){ + dvec3 point=points_[j].pointG_-0.5*points_[i].point_; + if(!is_init){ + this->set_bbox(bbox,point); + is_init=1; + if(copy_info) copy_info->init_bbox_=1; + } else { + this->add_to_bbox(bbox,point); + } + point=points_[j].pointG_+0.5*points_[i].point_; this->add_to_bbox(bbox,point); } - point=points_[j].pointG_+0.5*points_[i].point_; - this->add_to_bbox(bbox,point); - } - } else { - if(!is_init){ - this->set_bbox(bbox,points_[i].pointG_); - is_init=1; } else { - this->add_to_bbox(bbox,points_[i].pointG_); + if(!is_init){ + this->set_bbox(bbox,points_[i].pointG_); + is_init=1; + } else { + this->add_to_bbox(bbox,points_[i].pointG_); + } } } + is_calculated_=1; } + + dvec3 anchor=this->give_anchor_axes(); // if(!is_calculated_){ // throw MyTSchar("region needs a point definition. line='%s'",line_.v()); // } - MyTSchar style(""); SvgmlEntity* styleEntity=NULL; + MyTSchar style; + style.print0(""); + int styleEntity=-1; MyTSchar* cclass=this->give_property(OP::cclass); if(cclass){ for(int i=0;iv())==0){ - styleEntity=&svgml.entities_[i]; + styleEntity=i; style=svgml.entities_[i].contents_; break; } } + } + if(copy_info && copy_info->style_.num()){ + style=copy_info->style_; + styleEntity=copy_info->styleEntity_; } switch(cmd_){ case OC::region: { @@ -3252,11 +3296,11 @@ MyTSchar* labelsTS=this->give_property(OP::labels); if(labelsTS){ int pos=string_isin_pos(labelsTS->v(),SvgmlPointsConnections_g_); if(pos!=-1){ label=SvgmlPointsConnections(pos); - } else if(strcmp(labelsTS->v(),"0")==0){ + } else if(strcmp(labelsTS->v(),"0")==0 || strcmp(labelsTS->v(),"")==0){ label=TPC::none; } else if(strcmp(labelsTS->v(),"1")==0){ label=TPC::all; } else { throw MyTSchar("unrecognized 'labels' value. line='%s'",line_.v()); @@ -3338,12 +3382,12 @@ MyTSchar* text=this->give_property(OP::text); if(!text) break; MyTSchar font_family("Verdana;sans-serif"); int found=0; - if(styleEntity){ - MyTSchar* font_familyP=styleEntity->give_property(OP::font_family); + if(styleEntity!=-1){ + MyTSchar* font_familyP=svgml.entities_[styleEntity].give_property(OP::font_family); if(font_familyP){ font_family=*font_familyP; font_family.regsub(0,",.*$",""); font_family.regsub(0,"^\\s*\"|\"\\s*$",""); found=1; @@ -3351,12 +3395,12 @@ } if(!found){ style.printE("font-family: %s;",font_family.v()); } found=0; - if(styleEntity){ - MyTSchar* font_sizeP=styleEntity->give_property(OP::font_size); + if(styleEntity!=-1){ + MyTSchar* font_sizeP=svgml.entities_[styleEntity].give_property(OP::font_size); if(font_sizeP){ font_size=atof(font_sizeP->v()); found=1; } else { font_size=14; @@ -3438,11 +3482,12 @@ p1D1[0]=p0D1[0]; p1D2[0]=p0D2[0]; } pLabel=0.7*vN+0.5*(p0D1+p1D1); } else { - pLabel=dvec3(bbox_[0],bbox_[1],0); + pLabel=points_[0].pointG_; + //pLabel=dvec3(bbox_[0],bbox_[1],0); vN=anchor; } if(cmd_==OC::dimension){ MyTSchar styleT("stroke:black;stroke-width:1px;%s",style.v()); out.printE("\n",p0[0], @@ -3459,10 +3504,11 @@ MyTSchar styleT("stroke:black;stroke-width:1px;%s",style.v()); styleT.printE("marker-end:url(#TriangleOutL);"); out.printE("\n",p0D[0], p0D[1],p1D[0],p1D[1],id_.v(),styleT.v()); + pLabel=p0D; } if(anchor[1]==1){ pLabel[1]+=text_box[1]+text_box[3]; } else if(anchor[1]==-1){ @@ -3540,47 +3586,77 @@ out.printE("\n"); } break; case OC::copy: { - MyTSvec entities; - SvgmlEntity* parent=svgml.give_entity(id_parent_.v()); - entities.append(parent); - MyTSchar* include_children=this->give_property(OP::include_children); - if(include_children && strcmp(include_children->v(),"1")==0){ - svgml.give_descendants(id_parent_.v(),id_.v(),entities); + int parent=svgml.give_entityN(id_parent_.v()); + + MyTSint entities; + MyTSchar* from=this->give_property(OP::from); + if(from){ + MyTScharList idsList; + string_split_text_sep(from->v(),-1,",",idsList); + for(int i=0;igive_property(OP::include_children); + if(include_children && strcmp(include_children->v(),"1")==0){ + MyTSchar id("%s.%s",id_parent_.v(),id_short_.v()); + svgml.give_descendants(id_parent_.v(),id.v(),entities); + } } - Svgml_copy copy_info; + Svgml_copy copy_infoL; MyTSchar* connect_classTS=this->give_property(OP::connect_class); if(connect_classTS){ - copy_info.connect_class_=*connect_classTS; + copy_infoL.connect_class_=*connect_classTS; } else { connect_classTS=this->give_property(OP::cclass); if(connect_classTS){ - copy_info.connect_class_=*connect_classTS; + copy_infoL.connect_class_=*connect_classTS; } else { - connect_classTS=parent->give_property(OP::cclass); + connect_classTS=svgml.entities_[parent].give_property(OP::cclass); if(connect_classTS){ - copy_info.connect_class_=*connect_classTS; + copy_infoL.connect_class_=*connect_classTS; } else { throw MyTSchar("necessary a class for copy line='%s'",line_.v()); } } } MyTSchar* labels=this->give_property(OP::labels); if(labels){ - copy_info.labels_=*labels; + copy_infoL.labels_=*labels; } MyTSchar* connect=this->give_property(OP::connect); if(connect){ - copy_info.connect_=*connect; + copy_infoL.connect_=*connect; } - copy_info.style_=style; - copy_info.entity_=this; + copy_infoL.style_=style; + copy_infoL.styleEntity_=styleEntity; + copy_infoL.entity_=this; + + int number=1; + MyTSchar* numberTS=this->give_property(OP::number); + if(numberTS){ + number=atoi(numberTS->v()); + } - Svgml_copy_OP& op=copy_info.operations_.incr_num(); + if(copy_info){ + copy_infoL.operations_=copy_info->operations_; + } + copy_infoL.operations_.set_min_memnum(copy_infoL.operations_.num()+number); + Svgml_copy_OP& op=copy_infoL.operations_.incr_num(); MyTSchar* operationTS=this->give_property(OP::operation); if(operationTS){ MyTScharList list; string_split_text_sep(operationTS->v(),-1,",",list); @@ -3630,39 +3706,42 @@ } else { throw MyTSchar("'copy' must have a delta-point property or two " "points. line='%s'",line_.v()); } } - int number=1; - MyTSchar* numberTS=this->give_property(OP::number); - if(numberTS){ - number=atoi(numberTS->v()); - } int numE=svgml.entities_.num(); int numO=out.num(); for(int i=1;i<=number;i++){ if(i>1){ - copy_info.operations_.incr_num()=op; + copy_infoL.operations_.incr_num()=op; } for(int j=0;jid_.v()); } } } break; case OC::svgml: case OC::cclass: break; default: { - throw MyTSchar("unknow command. line='%s'",line_.v()); + throw MyTSchar("unknown command. line='%s'",line_.v()); } break; } } @@ -3680,27 +3759,63 @@ for(int i=0;igive_idTS().regexp(0,"^(0|__ROOT)$")==0){ + parent->remove_abbreviations(svgml); + } + if(is_abbreviated){ + id_parent_=parent->give_idTS(); + id_.print0("%s.%s",id_parent_.v(),id_short_.v()); + } +} Svgml::Svgml(SvgmlOutputType otype): otype_(otype) { if(!Svgml::propNames_) Svgml::propNames_=new Mytextlongtable(SvgmlProperties_g_); if(!Svgml::cmdNames_) Svgml::cmdNames_=new Mytextlongtable(SvgmlCommands_g_); } -SvgmlEntity* Svgml::give_entity(const char* id) +SvgmlEntity* Svgml::give_entity(const char* id,int* is_abbreviated) { - SvgmlEntity* ret=NULL; + int ret=this->give_entityN(id,is_abbreviated); + if(ret==-1) return NULL; + return &entities_[ret]; +} + +int Svgml::give_entityN(const char* id,int* is_abbreviated) +{ + int ret=-1; for(int i=0;i1){ + int retL=this->give_entityN(list[0].v(),is_abbreviated); + if(retL!=-1){ + list[0]=entities_[retL].id_; + MyTSchar idTS=string_join(list,"."); + return this->give_entityN(idTS.v(),is_abbreviated); + } } } return ret; } @@ -3707,17 +3822,32 @@ void Svgml::give_descendants(const char* id,const char* id_avoid, MyTSvec& entities) { size_t n=strlen(id); for(int i=0;iexists(mtsA[1].v())){ mtsA[1].setV(&buffer[startL],endAL-startL); throw MyTSchar("unknown command '%s' line='%s'",mtsA[1].v(),mtsA[0].v()); @@ -3945,10 +4075,19 @@ throw MyTSchar("unknown line '%s'",mtsA[1].v()); } i=endAL; } + +//################################################################################ +// abbreviated names to names +//################################################################################ + + for(int i=0;i\n" "" - "\n" + "\n"; + out.printE(xmlH,width_,height_); - "\n" + const char* xmlTriangleInL= + "\n" "\n" - "\n" + "fill='%s' transform='scale(-1.0)'/>\n" + "\n"; + out.printE(xmlTriangleInL,"TriangleInL","context-stroke"); - "\n" + const char* xmlTriangleOutL= + "\n" "\n" - "\n" + "fill='%s'/>\n" + "\n"; + out.printE(xmlTriangleOutL,"TriangleOutL","context-stroke"); - "\n" + const char* xmlCircle= + "\n" "\n" - "\n" + "fill='%s'/>\n" + "\n"; + out.printE(xmlCircle,"circle","context-stroke"); + const char* xmlFilters= "" "" "" "" @@ -4007,13 +4154,12 @@ "" "" "" "" "" - ""; - - out.printE(xmlH,width_,height_,stp,stp,stp); + "\n"; + out.printE(xmlFilters); //################################################################################ // radial_gradient //################################################################################ @@ -4028,13 +4174,52 @@ "\n" "\n" "\n" "\n",id.v(),list[0].v(),list[1].v()); v.print0("url(#%s)",id.v()); + entities_[i].update_contents_from_properties(); radial_gradient++; } } + +//################################################################################ +// markers not black +//################################################################################ + + MytextDict used_ids; + for(int i=0;ivalue_.v(),"black")==0 || strcmp(stroke->value_.v(),"#000000")==0){ + continue; + } + MyTSchar mATS[2]; + if(v.regexp(0,"^url\\(#(circle|TriangleInL|TriangleOutL)\\)$",mATS,2)==0) continue; + MyTSchar id("%s_%s",mATS[1].v(),stroke->value_.v()); + + if(!used_ids.exists(id.v())){ + if(strcmp(mATS[1].v(),"TriangleInL")==0){ + out.printE(xmlTriangleInL,id.v(),stroke->value_.v()); + } else if(strcmp(mATS[1].v(),"TriangleOutL")==0){ + out.printE(xmlTriangleOutL,id.v(),stroke->value_.v()); + } else { + out.printE(xmlCircle,id.v(),stroke->value_.v()); + } + used_ids.set(id.v(),""); + } + v.print0("url(#%s)",id.v()); + entities_[i].update_contents_from_properties(); + } + } + } + +//################################################################################ +// end defs +//################################################################################ + out.printE("\n"); //################################################################################ // loop on entities. The tries are here to solve dependencies of dependencies //################################################################################ @@ -4041,14 +4226,21 @@ int num=out.num(); for(int i_try=0;i_try<10;i_try++){ int needs_recalculate=0; for(int i=0;i properties_; public: - int is_calculated_; + int is_calculated_,is_dependent_; glm::dvec4 bbox_; MyTSvec points_; MM gid_start_numbers_; }; @@ -400,13 +405,16 @@ void init_rdinfo_lineNum(int lineNum,int lineNum_pos); void give_rdinfo_lineNum(int& lineNum,int& lineNum_pos); void update_rdinfo_lineNum(MyTSchar& buffer,MyTSchar& out,int start, int is_continuation); - SvgmlEntity* give_entity(const char* id); + SvgmlEntity* give_entity(const char* id,int* is_abbreviated=NULL); + int give_entityN(const char* id,int* is_abbreviated=NULL); void give_descendants(const char* id,const char* id_avoid, MyTSvec& entities); + void give_descendants(const char* id,const char* id_avoid, + MyTSint& entities); protected: MyTSchar version_; double width_,height_; MytextDict variables_; @@ -443,12 +451,14 @@ }; class Svgml_copy { public: + Svgml_copy(): init_bbox_(0),styleEntity_(-1){} SvgmlEntity* entity_; MyTSchar style_,connect_class_,labels_,connect_; + int init_bbox_,styleEntity_; MyTSvec operations_; }; void svgml_process(SvgmlOutputType otype,MyTSchar& buffer,MyTSchar& out, int start,int end,int& lineNum,int& lineNum_pos);