MCPcopy Create free account
hub / github.com/MapServer/MapServer / parse_poly

Method parse_poly

renderers/agg/src/agg_svg_parser.cpp:688–731  ·  view source on GitHub ↗

-------------------------------------------------------------

Source from the content-addressed store, hash-verified

686
687 //-------------------------------------------------------------
688 void parser::parse_poly(const char** attr, bool close_flag)
689 {
690 int i;
691 double x = 0.0;
692 double y = 0.0;
693
694 m_path.begin_path();
695 for(i = 0; attr[i]; i += 2)
696 {
697 if(!parse_attr(attr[i], attr[i + 1]))
698 {
699 if(strcmp(attr[i], "points") == 0)
700 {
701 m_tokenizer.set_path_str(attr[i + 1]);
702 if(!m_tokenizer.next())
703 {
704 throw exception("parse_poly: Too few coordinates");
705 }
706 x = m_tokenizer.last_number();
707 if(!m_tokenizer.next())
708 {
709 throw exception("parse_poly: Too few coordinates");
710 }
711 y = m_tokenizer.last_number();
712 m_path.move_to(x, y);
713 while(m_tokenizer.next())
714 {
715 x = m_tokenizer.last_number();
716 if(!m_tokenizer.next())
717 {
718 throw exception("parse_poly: Odd number of coordinates");
719 }
720 y = m_tokenizer.last_number();
721 m_path.line_to(x, y);
722 }
723 }
724 }
725 }
726 if(close_flag)
727 {
728 m_path.close_subpath();
729 }
730 m_path.end_path();
731 }
732
733 //-------------------------------------------------------------
734 void parser::parse_transform(const char* str)

Callers 1

start_elementMethod · 0.95

Calls 9

exceptionClass · 0.85
begin_pathMethod · 0.80
set_path_strMethod · 0.80
nextMethod · 0.80
last_numberMethod · 0.80
close_subpathMethod · 0.80
end_pathMethod · 0.80
move_toMethod · 0.45
line_toMethod · 0.45

Tested by

no test coverage detected