|
From: <xf...@us...> - 2013-12-05 14:13:53
|
Revision: 1878
http://sourceforge.net/p/scstudio/code/1878
Author: xfarmad
Date: 2013-12-05 14:13:49 +0000 (Thu, 05 Dec 2013)
Log Message:
-----------
basic MSC colors
Modified Paths:
--------------
trunk/make_build.bat
trunk/src/data/CMakeLists.txt
trunk/src/data/exporttex/exportTex.cpp
trunk/src/data/msc/CoregionArea.cpp
trunk/src/data/msc/CoregionArea.h
trunk/src/data/msc/MscElement.h
trunk/src/data/msc.h
trunk/src/data/msc_types.h
trunk/src/view/visio/addon/extract.cpp
trunk/src/view/visio/addon/extract.h
trunk/src/view/visio/addon/shapeutils.cpp
trunk/src/view/visio/addon/shapeutils.h
trunk/src/view/visio/addon/visualize.cpp
trunk/src/view/visio/addon/visualize.h
Added Paths:
-----------
trunk/src/data/msc/MscColor.h
Modified: trunk/make_build.bat
===================================================================
--- trunk/make_build.bat 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/make_build.bat 2013-12-05 14:13:49 UTC (rev 1878)
@@ -8,8 +8,8 @@
set ACTION=build
REM set the following to Release or to Debug
-set TARGET=Release
-rem set TARGET=Debug
+rem set TARGET=Release
+set TARGET=Debug
echo %ACTION% in %TARGET% mode into scstudio-setup-%VERSION%.exe
echo(
@@ -19,11 +19,11 @@
REM Even explicitelly specified address is without qoutes here.
set PROJECT_TRUNK_DIR=%CD%
REM Contrary to the previous one, others are in qoutes!
-set DEVENV_COMMAND="C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com"
+set DEVENV_COMMAND="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com"
set CMAKE_EXE="C:\Program Files (x86)\CMake 2.8\bin\cmake.exe"
set CMAKE_EXE_GUI="C:\Program Files (x86)\CMake 2.8\bin\cmake-gui.exe"
-set NSIS_EXE="C:\Program Files\NSIS\makensis.exe"
-set SIGN_TOOL_EXE="C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\signtool.exe"
+set NSIS_EXE="C:\Program Files (x86)\NSIS\makensis.exe"
+set SIGN_TOOL_EXE="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\signtool.exe"
echo Cmake...
IF "%ACTION%"=="rebuild" (
Modified: trunk/src/data/CMakeLists.txt
===================================================================
--- trunk/src/data/CMakeLists.txt 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/CMakeLists.txt 2013-12-05 14:13:49 UTC (rev 1878)
@@ -75,6 +75,7 @@
msc/LocalAction.h
msc/LocalActionEvent.h
msc/Msc.h
+ msc/MscColor.h
msc/MscElement.h
msc/MscElementTmpl.h
msc/MscMessage.h
Modified: trunk/src/data/exporttex/exportTex.cpp
===================================================================
--- trunk/src/data/exporttex/exportTex.cpp 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/exporttex/exportTex.cpp 2013-12-05 14:13:49 UTC (rev 1878)
@@ -48,6 +48,116 @@
typedef boost::shared_ptr<Coordinate> CoordinatePtr;
+class ColorMap{
+private:
+ std::map<MscColor,int> color_map;
+ MscColor m_last;
+ std::string m_name;
+ std::string m_description;
+ std::string m_length_name;
+public:
+
+ ColorMap()
+ {
+
+ }
+
+ ColorMap(std::string name)
+ {
+ m_name.append(name);
+ }
+
+ void setName(std::string name)
+ {
+ m_name.clear();
+ m_name.append(name);
+ }
+
+ void setLengthName(std::string name)
+ {
+ m_length_name.clear();
+ m_length_name.append(name);
+ }
+
+ void setDescription(std::string description)
+ {
+ m_description.clear();
+ m_description.append(description);
+ }
+
+ void addColor(MscColor color)
+ {
+ if(color_map.find(color)==color_map.end())
+ {
+ color_map.insert( std::make_pair<MscColor,int>(color, color_map.size()));
+ }
+ }
+
+ std::string getId(MscColor color)
+ {
+ std::ostringstream result;
+ if(color_map.find(color)!=color_map.end())
+ {
+ result << m_name;
+ int range = 'Z' - 'A' + 1;
+ int identificator = color_map.find(color)->second;
+ std::string id;
+ do{
+ id.push_back(('A'+(identificator%range)));
+ identificator /= range;
+ }while(identificator != 0);
+ for(std::string::reverse_iterator it = id.rbegin(); it != id.rend(); it++)
+ {
+ result << *it;
+ }
+ }
+ else
+ {
+ throw std::runtime_error("ExportTex: Undefined color in diagram!");
+ }
+ return result.str();
+ }
+
+ std::string printOptParam(MscColor color){
+ std::ostringstream result;
+ result << "[" << getId(color) << "]";
+ return result.str();
+ }
+
+ std::string printColor(MscColor color){
+ std::ostringstream result;
+ if(color!=m_last)
+ {
+ result << "\\mscsetcolor{" << getId(color) << "}" << std::endl;
+ m_last = color;
+ }
+ return result.str();
+ }
+
+
+ std::string print()
+ {
+ std::ostringstream result;
+ if(!color_map.empty()){
+ result << m_description << std::endl;
+ double red, green, blue;
+ for(std::map<MscColor,int>::iterator it = color_map.begin(); it!=color_map.end(); it++)
+ {
+ it->first.getColorD(red,green,blue);
+ result << "\\definecolor{" << getId(it->first) << "}{rgb}{" << red << ", "
+ << green << ", " << blue << "}" << std::endl;
+ }
+ result << std::endl;
+ }
+
+ return result.str();
+ }
+
+ bool empty(){
+ return color_map.empty();
+ }
+};
+
class DistanceMap{
private:
//coordinate - size, int - number to distinguish names of sizes
@@ -299,6 +409,7 @@
DistanceMap m_instance_spacing_map;
DistanceMap m_slope_size_map;//! map of slope values
DistanceMap m_incomlete_mess_slope_map;
+ ColorMap m_colors;
std::list<std::pair<Coordinate,Coordinate> > m_slope_coordinates_map;//! list of (start,end) coordinates of slope
std::list<std::pair<Coordinate,Coordinate> > m_time_interval_slope_coordinates_map;//! list of (start,end) coordinates of slope
std::list<std::pair<Coordinate,Coordinate> > m_order_slope_coordinates_map;//! list of (start,end) coordinates of slope
@@ -334,38 +445,15 @@
return cor;
}
- void print_color(const MarkType& mark){
- if(mark == m_last_mark){
- //nothing to change
- return;
- }
- switch(mark)
- {
- case NONE: print_color_change("black"); break;
- case REMOVED:
- case MARKED: print_color_change("red"); break;
- case ADDED: print_color_change("green"); break;
- default: throw std::runtime_error("Error: unexpected behaviour");
- }
- m_last_mark = mark;
+ void print_color(const MscColor& color){
+ m_stream << m_colors.printColor(color);
}
- void print_opt_color(const MarkType& mark)
+ std::string print_opt_color(const MscColor& color)
{
- switch(mark)
- {
- case NONE: break;
- case REMOVED:
- case MARKED: m_stream << "[red]"; break;
- case ADDED: m_stream << "[green]"; break;
- default: throw std::runtime_error("Error: unexpected behaviour");
- }
+ return m_colors.printOptParam(color);
}
- void print_color_change(std::string color){
- m_stream << "\\mscsetcolor{" << color << "}" << std::endl;
- }
-
bool findPtr(MscElementPtrList list, MscElementPtr element)
{
for (MscElementPtrList::iterator nextIt = list.begin(); list.end() != nextIt ; nextIt++)
@@ -404,7 +492,7 @@
CoregEventRelPtrVector rels = coregion->get_successor_rels(event.get());
for(CoregEventRelPtrVector::const_iterator spos = rels.begin(); spos != rels.end(); spos++)
{
- print_color((*spos)->get_marked());
+ print_color((*spos)->get_color());
print_order(event, (*spos)->get_successor());
}
}
@@ -433,7 +521,7 @@
receiveY += Compare::round(coregion_receive_event->get_area()->get_begin_height());
}
receiveY += complete_message->get_receive_event()->get_instance()->get_line_begin().get_y();
- print_color(complete_message->get_marked());
+ print_color(complete_message->get_color());
m_stream << m_slope_size_map.printLength(sendY,receiveY,true);
m_stream << "\\mess{" << ExportTex::print_wchar(complete_message->get_label())
<< "}{"<< m_instance_id_map.get_id(inst_pos(complete_message->get_sender())) << "_inst}[0.3]{"
@@ -452,16 +540,12 @@
}
}
- //only complete message is printed on send event (receive event is skipped)
- //for all other items we can print color
- print_color(event->get_marked());
-
if (msg_event != NULL)
{
IncompleteMessagePtr incomplete_message = msg_event->get_incomplete_message();
if(incomplete_message != NULL)
{
- print_color(incomplete_message->get_marked());
+ print_color(incomplete_message->get_color());
//get_dot_position() distance from event
m_stream << m_lostfound_width_map.printLength(fabs(incomplete_message_width_corection(incomplete_message->get_dot_position().get_x())));
if(incomplete_message->is_lost())
@@ -482,6 +566,7 @@
if (act != NULL)
{
assert(lae->get_instance() != NULL);
+ print_color(act->get_color());
m_stream << m_local_action_width_map.printLength(act->get_width());
m_stream << m_local_action_height_map.printLength(act->get_height());
m_stream << "\\action*{" << ExportTex::print_wchar(act->get_statement()) << "}{" << m_instance_id_map.get_id(inst_pos(lae->get_instance())) << "_inst}" << std::endl;
@@ -494,6 +579,7 @@
if(cond != NULL)
{
assert(ce->get_instance() != NULL);
+ print_color(cond->get_color());
m_stream << m_local_condition_height_map.printLength(cond->get_height());
m_stream << m_local_condition_width_map.printLength(cond->get_width()/2);
m_stream << "\\condition*{" << ExportTex::print_wchar(cond->get_text()) << "}{" << m_instance_id_map.get_id(inst_pos(ce->get_instance())) << "_inst}" << std::endl;
@@ -511,10 +597,8 @@
Coordinate cor = coregionArea->get_begin_height() + coregionArea->get_instance()->get_line_begin().get_y();
if(Compare::equal(cor, coordinate))
{
- print_color(coregionArea->get_marked());
- m_stream << "\\regionstart{coregion}";
- print_opt_color(coregionArea->get_marked());
- m_stream << "{" << m_instance_id_map.get_id(inst_pos(coregionArea->get_instance())) << "_inst}"
+ m_stream << "\\regionstart{coregion}" << print_opt_color(coregionArea->get_color())
+ << "{" << m_instance_id_map.get_id(inst_pos(coregionArea->get_instance())) << "_inst}"
<< m_coregion_width_map.printOptParam(coregionArea->get_width()) << std::endl;
return;
}
@@ -583,7 +667,7 @@
for(CommentPtrSet::const_iterator cpos = event->get_comments().begin();
cpos != event->get_comments().end(); cpos++)
{
- print_color((*cpos)->get_marked());
+ print_color((*cpos)->get_color());
m_stream << m_comment_width_map.printLength(event->get_instance()->get_line_begin().get_x(),(*cpos)->get_position().get_x(),true);
m_stream << m_comment_slope_map.printLength((*cpos)->get_position().get_y(),event->get_position().get_y()+coordinate);
m_stream << "\\msccomment";
@@ -627,10 +711,8 @@
}
if(Compare::equal((*min)->get_line_begin().get_y(),first))
{
- print_color((*min)->get_marked());
m_stream << "\\declinst" << m_instance_width_map.printOptParam((*min)->get_width()) << "{" << m_instance_id_map.get_id(inst_pos((*min))) << "_inst}"
- << m_instance_height_map.printOptParam(3) << "{" << ExportTex::print_wchar((*min)->get_label()) << "}";
- print_opt_color((*min)->get_marked());
+ << m_instance_height_map.printOptParam(3) << "{" << ExportTex::print_wchar((*min)->get_label()) << "}" << print_opt_color((*min)->get_color());
m_stream << "{}" << std::endl;
}
else
@@ -655,8 +737,8 @@
{
m_stream << "\\create{}{}{" << m_instance_id_map.get_id(inst_pos(instance)) << "_inst}"
<< m_instance_width_map.printOptParam(instance->get_width()) << "{"
- << ExportTex::print_wchar(instance->get_label()) << "}" << m_instance_height_map.printOptParam(3) << "{}";
- print_opt_color(instance->get_marked());
+ << ExportTex::print_wchar(instance->get_label()) << "}" << m_instance_height_map.printOptParam(3) << "{}"
+ << print_opt_color(instance->get_color());
m_stream << std::endl;
return;
}
@@ -675,7 +757,7 @@
for(AbsoluteTimePtrList::const_iterator apos = absolute_times.begin();
apos != absolute_times.end(); apos++)
{
- print_color((*apos)->get_marked());
+ print_color((*apos)->get_color());
m_stream << m_absolutetime_width_map.printLength((*apos)->get_position().get_x(),event->get_instance()->get_line_begin().get_x(),true);
m_stream << m_absolutetime_slope_map.printLength((*apos)->get_position().get_y(),coordinate+event->get_position().get_y(),true);
m_stream << "\\mscmark[";
@@ -705,7 +787,7 @@
{
if((*rpos)->get_event_a()==event)
{
- print_color((*rpos)->get_marked());
+ print_color((*rpos)->get_color());
m_stream << m_timeinterval_slope_map.printLength(getTimeRelationSlope(*rpos));
m_stream << m_timeinterval_width_map.printLength(7);
m_stream << "\\measure[";
@@ -733,7 +815,7 @@
cpos != m_bmsc->get_comments().end(); cpos++)
{
//position is x = middle of comment, y = up side, width is width of whole comment
- print_color((*cpos)->get_marked());
+ print_color((*cpos)->get_color());
Coordinate bmsc_begin_x = m_bmsc->get_instances().begin()->get()->get_line_begin().get_x();
Coordinate bmsc_begin_y = m_bmsc->get_instances().begin()->get()->get_line_begin().get_y();
if(!Compare::equal(last_width,(*cpos)->get_width())){
@@ -834,6 +916,8 @@
m_stream << m_instance_spacing_map.print();
+ m_stream << m_colors.print();
+
//print end
m_stream << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl
<< "%%%% End of configuration header" << std::endl
@@ -868,6 +952,7 @@
Coordinate cor = comment->get_position().get_y()+coordinate;
edge_point(comment->get_position().get_x(),comment->get_width());
insert_pointer(comment,cor);
+ m_colors.addColor(comment->get_color());
};
void insert_event(EventPtr event, Coordinate coordinate = 0)
@@ -876,6 +961,8 @@
LocalActionEventPtr local_action_event = boost::dynamic_pointer_cast<LocalActionEvent>(event);
ConditionEventPtr condition_event = boost::dynamic_pointer_cast<ConditionEvent>(event);
+ m_colors.addColor(event->get_color());
+
Coordinate coor = event->get_position().get_y()+coordinate; //! event absolute position in diagram
CoregionArea* coregion = dynamic_cast<CoregionArea*>(event->get_area());
@@ -929,6 +1016,7 @@
CompleteMessagePtr complete_message = msg_event->get_complete_message();
if(complete_message != NULL)
{
+ m_colors.addColor(complete_message->get_color());
if(complete_message->get_send_event() == msg_event)
{
Coordinate send_y = Compare::round(complete_message->get_send_event()->get_position().get_y());
@@ -957,6 +1045,7 @@
IncompleteMessagePtr incomplete_message = msg_event->get_incomplete_message();
if(incomplete_message != NULL)
{
+ m_colors.addColor(incomplete_message->get_color());
edge_point(incomplete_message->get_event()->get_instance()->get_line_begin().get_x()+incomplete_message->get_dot_position().get_x());
m_incomlete_mess_slope_map.addDistance(incomplete_message->get_dot_position().get_y());
m_lostfound_width_map.addDistance(fabs(incomplete_message_width_corection(incomplete_message->get_dot_position().get_x())));
@@ -967,6 +1056,7 @@
LocalActionPtr act = local_action_event->get_local_action();
if (act != NULL)
{
+ m_colors.addColor(act->get_color());
assert(local_action_event->get_instance() != NULL);
edge_point(local_action_event->get_instance()->get_line_begin().get_x(), act->get_width());
m_local_action_width_map.addDistance(act->get_width());
@@ -978,6 +1068,7 @@
ConditionPtr cond = condition_event->get_condition();
if (cond != NULL)
{
+ m_colors.addColor(cond->get_color());
assert(condition_event->get_instance() != NULL);
edge_point(condition_event->get_instance()->get_line_begin().get_x(), cond->get_width());
m_local_condition_width_map.addDistance(cond->get_width()/2);
@@ -992,6 +1083,7 @@
void insert_coregion_area(CoregionAreaPtr coregion_area, Coordinate coordinate = 0)
{
+ m_colors.addColor(coregion_area->get_color());
edge_point(coregion_area->get_instance()->get_line_begin().get_x(),coregion_area->get_width());
//coregion_end_Width_map insert coregion end width
insert_pointer(coregion_area,coregion_area->get_begin_height()+coordinate);
@@ -1008,6 +1100,7 @@
for(AbsoluteTimePtrList::const_iterator apos = absolute_times.begin();
apos != absolute_times.end(); apos++)
{
+ m_colors.addColor((*apos)->get_color());
edge_point((*apos)->get_position().get_x());
m_absolutetime_width_map.addDistance((*apos)->get_position().get_x(),event->get_instance()->get_line_begin().get_x(),true);
m_absolutetime_slope_map.addDistance((*apos)->get_position().get_y(),coordinate,true);
@@ -1016,6 +1109,7 @@
for(TimeRelationEventPtrList::const_iterator rpos = relations.begin();
rpos != relations.end(); rpos++)
{
+ m_colors.addColor((*rpos)->get_color());
// for each "event a" we print the time relation to "event b"
// we thus skip all "events b"
if((*rpos)->get_event_a() != event)
@@ -1059,6 +1153,7 @@
void insert_instance(const InstancePtr instance)
{
+ m_colors.addColor(instance->get_color());
m_instance_width_map.addDistance(instance->get_width());
insert_pointer(instance,instance->get_line_begin().get_y());
insert_pointer(instance,instance->get_line_end().get_y());
@@ -1611,6 +1706,9 @@
m_incomlete_mess_slope_map.setDescription("%%%% Incomplete message slope:");
m_incomlete_mess_slope_map.setLengthName("levelheight");
m_incomlete_mess_slope_map.setIsLength(false);
+ m_colors.setName("color");
+ m_colors.setDescription("%%% Colors:");
+ m_colors.setLengthName("color");
m_last_mark = NONE;
// not in structure lengths
m_instance_height_map.addDistance(3);
@@ -1658,6 +1756,7 @@
ipos != m_bmsc->get_instances().end(); ipos++)
{
insert_instance((*ipos));
+
Coordinate inst_start = (*ipos)->get_line_begin().get_y();
//find edge instances
@@ -1676,7 +1775,9 @@
{
const EventPtrList& events = strict_area->get_events();
for (EventPtrList::const_iterator it = events.begin(); it != events.end(); ++it)
+ {
insert_event(*it, inst_start);
+ }
}
//coredionArea
@@ -1695,7 +1796,7 @@
for(EventPtrList::const_iterator epos = event_stack.begin(); epos != event_stack.end(); epos++)
{
insert_event(*epos,coregion_area->get_begin_height()+inst_start);
-
+
// process forward links
CoregEventRelPtrVector rels = coregion_area->get_successor_rels(epos->get());
for(CoregEventRelPtrVector::const_iterator spos = rels.begin(); spos != rels.end(); spos++)
@@ -1805,29 +1906,14 @@
DistanceMap m_conection_radius;
DistanceMap m_time_interval_width;
DistanceMap m_start_symbol_width;
+ ColorMap m_colors;
MarkType m_last_mark;
PtrIDMap<HMscNodePtr> node_id_map; // node identifiers
- void print_color(const MarkType& mark){
- if(mark == m_last_mark){
- //nothing to change
- return;
- }
- switch(mark)
- {
- case NONE: print_color_change("black"); break;
- case REMOVED:
- case MARKED: print_color_change("red"); break;
- case ADDED: print_color_change("green"); break;
- default: throw std::runtime_error("Error: unexpected behaviour");
- }
- m_last_mark = mark;
+ void print_color(const MscColor& color){
+ m_stream << m_colors.printColor(color);
}
- void print_color_change(std::string color){
- m_stream << "\\mscsetcolor{" << color << "}" << std::endl;
- }
-
/*
* In structure is position system left most = the lowest value && right most = the highest value (same as in tex)
* bottom most = the lowest value && upper most = the highest value (opposite as in tex)
@@ -1957,7 +2043,8 @@
<< m_condition_width.print() << std::endl
<< m_condition_height.print() << std::endl
<< m_conection_radius.print() << std::endl
- << m_time_interval_width.print() << std::endl;
+ << m_time_interval_width.print() << std::endl
+ << m_colors.print() << std::endl;
m_stream << "%%%%%%%%%%%%%%%%%%" << std::endl
@@ -1975,7 +2062,7 @@
// phase 1: print only constraints applied to this single node
if((*rpos)->get_ref_node_a() != (*rpos)->get_ref_node_b())
continue;
- print_color((*rpos)->get_marked());
+ print_color((*rpos)->get_color());
m_stream << "\\hmscmeasure" << ((*rpos)->is_directed() ? "[yes]" : "") << "{" << (*rpos)->get_label() << "}"
//<< Compare::round((*rpos)->get_width()) << "]{" << node_id_map.get_id((*rpos)->get_ref_node_a()) //width is not stored in structure
<< m_time_interval_width.printOptParam(14) << "{" << node_id_map.get_id((*rpos)->get_ref_node_a())
@@ -2014,7 +2101,7 @@
//i think it's better simple
width = 11;
- print_color((*rpos)->get_marked());
+ print_color((*rpos)->get_color());
m_stream << "\\hmscmeasure" << ((*rpos)->is_directed() ? "[yes]" : "") << "{" << (*rpos)->get_label() << "}"
<< m_time_interval_width.printOptParam(14) << "{" << node_id_map.get_id((*rpos)->get_ref_node_a())
<< "}[" << ((*rpos)->get_ref_node_a()->is_time_relation_bottom(*rpos) ? "bottom" : "top") << "]{"
@@ -2058,6 +2145,9 @@
m_start_symbol_width.setName("startSymbolWidth");
m_start_symbol_width.setLengthName("hmscstartsymbolwidth");
m_start_symbol_width.setIsVerticalLength(false);
+ m_colors.setName("color");
+ m_colors.setDescription("%%% Colors:");
+ m_colors.setLengthName("color");
//default lengths
m_reference_height.addDistance(10);
m_reference_width.addDistance(20);
@@ -2081,7 +2171,7 @@
for(CommentPtrSet::const_iterator cpos = m_hmsc->get_comments().begin();
cpos != m_hmsc->get_comments().end(); cpos++)
{
- print_color((*cpos)->get_marked());
+ print_color((*cpos)->get_color());
m_stream << m_global_comment_width.printLength((*cpos)->get_width());
m_stream << "\\mscglobalcomment{"
<< ExportTex::print_wchar((*cpos)->get_text()) << "}(" << get_pos_x((*cpos)->get_position().get_x() - ((*cpos)->get_width()/2)) << ","
@@ -2108,7 +2198,7 @@
StartNodePtr start_node = boost::dynamic_pointer_cast<StartNode>(*npos);
if(start_node != NULL)
{
- print_color(start_node->get_marked());
+ print_color(start_node->get_color());
m_stream << "\\hmscstartsymbol{" << node_id_map.get_id(*npos) << "}(" << get_pos_x(start_node->get_position().get_x())
<< "," << get_pos_y(start_node->get_position().get_y()) << ")"<< std::endl;
}
@@ -2116,7 +2206,7 @@
ConditionNodePtr condition_node = boost::dynamic_pointer_cast<ConditionNode>(*npos);
if(condition_node != NULL)
{
- print_color(condition_node->get_marked());
+ print_color(condition_node->get_color());
m_stream << "\\hmsccondition{" << node_id_map.get_id(*npos)
<< "}{" << ExportTex::print_string(condition_node->get_label()) << "}(" << get_pos_x(condition_node->get_position().get_x())
<< "," << get_pos_y(condition_node->get_position().get_y()) << ")" << std::endl;
@@ -2125,7 +2215,7 @@
ConnectionNodePtr connection_node = boost::dynamic_pointer_cast<ConnectionNode>(*npos);
if(connection_node != NULL)
{
- print_color(connection_node->get_marked());
+ print_color(connection_node->get_color());
m_stream << "\\hmscconnection{" << node_id_map.get_id(*npos)
<< "}(" << get_pos_x(connection_node->get_position().get_x())
<< "," << get_pos_y(connection_node->get_position().get_y()) << ")" << std::endl;
@@ -2136,7 +2226,7 @@
{
if(reference_node->get_msc() != NULL)
{
- print_color(reference_node->get_marked());
+ print_color(reference_node->get_color());
m_stream << "\\hmscreference{" << node_id_map.get_id(*npos)
<< "}{" << ExportTex::print_wchar(reference_node->get_msc()->get_label())
<< "}(" << get_pos_x(reference_node->get_position().get_x())
@@ -2150,7 +2240,7 @@
EndNodePtr end_node = boost::dynamic_pointer_cast<EndNode>(*npos);
if(end_node != NULL)
{
- print_color(end_node->get_marked());
+ print_color(end_node->get_color());
m_stream << "\\hmscendsymbol{" << node_id_map.get_id(*npos)
<< "}(" << get_pos_x(end_node->get_position().get_x())
<< "," << get_pos_y(end_node->get_position().get_y()) << ")" << std::endl;
@@ -2175,7 +2265,7 @@
for(CommentPtrSet::const_iterator cpos = (*npos)->get_comments().begin();
cpos != (*npos)->get_comments().end(); cpos++)
{
- print_color((*cpos)->get_marked());
+ print_color((*cpos)->get_color());
m_stream << "\\hmsccomment{"
<< ExportTex::print_wchar((*cpos)->get_text()) << "}(" << get_pos_x((*cpos)->get_position().get_x())
<< "," << get_pos_y((*cpos)->get_position().get_y()) << "){"
@@ -2226,7 +2316,7 @@
SuccessorNode *successor = (*spos)->get_successor();
HMscNode *successor_node = dynamic_cast<HMscNode*>(successor);
- print_color((*spos)->get_marked());
+ print_color((*spos)->get_color());
m_stream << "\\arrow{" << node_id_map.get_id(*npos) << "}";
std::list<MscPoint> line = (*spos)->get_line().get_points();
if(!line.empty())
Modified: trunk/src/data/msc/CoregionArea.cpp
===================================================================
--- trunk/src/data/msc/CoregionArea.cpp 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/msc/CoregionArea.cpp 2013-12-05 14:13:49 UTC (rev 1878)
@@ -90,14 +90,22 @@
return maxes;
}
-void CoregionArea::add_successor_rel(Event* predecessor, Event* successor)
+ CoregEventRelPtr CoregionArea::add_successor_rel(Event* predecessor, Event* successor)
{
vertex_t u = get_vertex(predecessor);
vertex_t v = get_vertex(successor);
edge_t e = boost::add_edge(u, v, m_events).first;
m_events[e] = new CoregionEventRelation(predecessor, successor);
+ return m_events[e];
}
+CoregEventRelPtr CoregionArea::add_successor_rel(Event* predecessor, Event* successor, MscColor color)
+{
+ CoregEventRelPtr result = add_successor_rel(predecessor, successor);
+ result->set_color(color);
+ return result;
+}
+
CoregEventRelPtrVector CoregionArea::get_successor_rels(const Event* e) const
{
CoregEventRelPtrVector result;
Modified: trunk/src/data/msc/CoregionArea.h
===================================================================
--- trunk/src/data/msc/CoregionArea.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/msc/CoregionArea.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -116,8 +116,10 @@
* After the operation, %predecessor will have %successor as its successor in the coregion.
* NOTE: both events must already exist in the coregion area
*/
- void add_successor_rel(Event* predecessor, Event* successor);
+ CoregEventRelPtr add_successor_rel(Event* predecessor, Event* successor);
+ CoregEventRelPtr add_successor_rel(Event* predecessor, Event* successor, MscColor color);
+
void remove_event(Event* e);
InstanceAxisForm get_form() const
Added: trunk/src/data/msc/MscColor.h
===================================================================
--- trunk/src/data/msc/MscColor.h (rev 0)
+++ trunk/src/data/msc/MscColor.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -0,0 +1,130 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2013 Adrian Farmadin <far...@ma...>
+ *
+ * $Id: MscElement.h 1724 2013-03-21 18:08:46Z obouda $
+ */
+
+#ifndef _MSCCOLOR_H
+#define _MSCCOLOR_H
+
+/**
+ * \brief Common basic class for color value
+ */
+class SCMSC_EXPORT MscColor
+{
+ private:
+ int m_R;
+ int m_G;
+ int m_B;
+ double m_color;
+
+ public:
+
+ MscColor()
+ {
+ clear();
+ };
+
+ void setColor(int R, int G, int B)
+ {
+ m_R=R;
+ m_G=G;
+ m_B=B;
+ };
+
+ void setColor(double color)
+ {
+ m_color=color;
+ };
+
+ void setColor(MscColor color)
+ {
+ setColor(color.m_R, color.m_G, color.m_B);
+ m_color = color.m_color;
+ };
+
+ double getColor() const
+ {
+ return m_color;
+ };
+
+ void getColor(int &R, int &G, int &B) const
+ {
+ R=m_R;
+ G=m_G;
+ B=m_B;
+ };
+
+#define color_round(x) floor(double(x)/255*1000)/1000
+
+ void getColorD(double &R, double &G, double &B) const
+ {
+ R=color_round(m_R);
+ G=color_round(m_G);
+ B=color_round(m_B);
+ };
+
+ int getRed() const
+ {
+ return m_R;
+ };
+
+ int getGreen() const
+ {
+ return m_G;
+ };
+
+ int getBlue() const
+ {
+ return m_B;
+ };
+
+ bool operator < (const MscColor& color) const {
+ if(color.m_color >=0 && m_color >=0)
+ {
+ return m_color < color.m_color;
+ }
+
+ int sum1,sum2;
+ sum1 = m_R + m_G +m_B;
+ sum2 = color.m_R + color.m_G + color.m_B;
+ return sum1 < sum2;
+ };
+
+ bool operator ==(const MscColor& color) const {
+ if(color.m_color >=0 && m_color >=0)
+ {
+ return m_color == color.m_color;
+ }
+
+ int sum1,sum2;
+ sum1 = m_R + m_G +m_B;
+ sum2 = color.m_R + color.m_G + color.m_B;
+ return sum1 == sum2;
+ };
+
+ bool operator !=(const MscColor& color) const {
+ return !(color==*this);
+ };
+
+ void clear()
+ {
+ setColor(0,0,0);
+ m_color = -1;
+ };
+};
+
+
+#endif // #ifndef _MSCCOLOR_H
Modified: trunk/src/data/msc/MscElement.h
===================================================================
--- trunk/src/data/msc/MscElement.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/msc/MscElement.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -38,6 +38,8 @@
//! Determines whether this element is in some way interesting for creator.
enum MarkType m_marked;
+ MscColor m_color;
+
protected:
MscElement()
@@ -190,6 +192,21 @@
m_marked = marked;
}
+ MscColor get_color() const
+ {
+ return m_color;
+ }
+
+ void set_color(MscColor color)
+ {
+ m_color.setColor(color);
+ }
+
+ void clear_color()
+ {
+ m_color.clear();
+ }
+
/**
* \brief See MscElementTmpl for details about attribute original
*/
Modified: trunk/src/data/msc.h
===================================================================
--- trunk/src/data/msc.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/msc.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -43,6 +43,7 @@
#include "data/time.h"
#include "data/export.h"
+class MscColor;
class MscElement;
class Comment;
class Commentable;
@@ -82,6 +83,7 @@
// end time extensions
+typedef boost::intrusive_ptr<MscColor> MscColorPtr;
typedef boost::intrusive_ptr<MscElement> MscElementPtr;
typedef boost::intrusive_ptr<Comment> CommentPtr;
@@ -178,6 +180,8 @@
enum MarkType {NONE, MARKED, ADDED, REMOVED, NOT_COVER, NOT_FULL_COVER, PATH};
+
+#include "msc/MscColor.h"
#include "data/msc/MscElement.h"
#include "data/msc/MscElementTmpl.h"
#include "data/msc/Comment.h"
Modified: trunk/src/data/msc_types.h
===================================================================
--- trunk/src/data/msc_types.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/data/msc_types.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -175,6 +175,11 @@
{
return m_points;
}
+
+ void push_back_point(MscPoint point)
+ {
+ m_points.push_back(point);
+ }
};
Modified: trunk/src/view/visio/addon/extract.cpp
===================================================================
--- trunk/src/view/visio/addon/extract.cpp 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/extract.cpp 2013-12-05 14:13:49 UTC (rev 1878)
@@ -437,6 +437,7 @@
std::set<long> relations;
CoregionAreaPtr area = new CoregionArea();
+ area->set_color(CShapeUtils::ExtractShapeColor(coregion));
// assert there is no connection to inner shapes of the coregion group
assert_no_nested_FromConnects(coregion);
@@ -666,9 +667,9 @@
{
// the position is determined from the X coordinate
if(pos1.m_x < pos2.m_x)
- area->add_successor_rel(event1->second.get(), event2->second.get());
+ area->add_successor_rel(event1->second.get(), event2->second.get(), CShapeUtils::ExtractShapeColor(line));
else if(pos2.m_x < pos1.m_x)
- area->add_successor_rel(event2->second.get(), event1->second.get());
+ area->add_successor_rel(event2->second.get(), event1->second.get(), CShapeUtils::ExtractShapeColor(line));
else
{
PrintError(stringize() << page_name << ": "
@@ -702,6 +703,13 @@
return area;
}
+InstancePtr CDrawingExtractor::new_instance_ptr(Visio::IVShapePtr shape, MscColor color)
+{
+ InstancePtr result = new_instance_ptr(shape);
+ result->set_color(color);
+ return result;
+}
+
InstancePtr CDrawingExtractor::new_instance_ptr(Visio::IVShapePtr shape)
{
InstancePtr result = new Instance((const wchar_t*)shape->Text);
@@ -737,7 +745,7 @@
for(int i = 1; i <= vsoPage->Shapes->Count; i++)
{
Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
-
+ MscColor shape_color = CShapeUtils::ExtractShapeColor(shape);
try
{
TShapeType type = get_shape_type(shape);
@@ -745,10 +753,14 @@
{
case ST_BMSC_INSTANCE:
instances[shape->ID] = new_instance_ptr(shape);
+ instances[shape->ID]->set_color(shape_color);
+ TRACE("INSTANCE COLOR: " << shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultStrU[visUnitsColor].GetBSTR());
+ TRACE("INSTANCE COLOR NUMBER: " << shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultIU);
break;
case ST_BMSC_MESSAGE:
elements[shape->ID] = new CompleteMessage((const wchar_t*)shape->Text);
+ elements[shape->ID]->set_color(shape_color);
break;
case ST_BMSC_MESSAGE_LOST:
{
@@ -756,6 +768,7 @@
// lost message: glued on begin, dot on end
new_message->set_dot_position(GetLineEnd(shape)-GetLineBegin(shape));
elements[shape->ID] = new_message;
+ elements[shape->ID]->set_color(shape_color);
break;
}
case ST_BMSC_MESSAGE_FOUND:
@@ -764,6 +777,7 @@
// found message: glued on end, dot on begin
new_message->set_dot_position(GetLineBegin(shape)-GetLineEnd(shape));
elements[shape->ID] = new_message;
+ elements[shape->ID]->set_color(shape_color);
break;
}
@@ -776,6 +790,7 @@
//new_local_action->set_width(GetControlPos(shape, _T("Height")));
//new_local_action->set_height(GetControlPos(shape, _T("Width")));
elements[shape->ID] = new_local_action;
+ elements[shape->ID]->set_color(shape_color);
break;
}
@@ -788,6 +803,7 @@
//new_local_condition->set_width(GetControlPos(shape, _T("Height")));
//new_local_condition->set_height(GetControlPos(shape, _T("Width")));
elements[shape->ID] = new_condition;
+ elements[shape->ID]->set_color(shape_color);
break;
}
@@ -798,6 +814,7 @@
//new_relation->set_directed(type == ST_TIME_DIRECTED);
new_relation->set_width(GetControlPos(shape, _T("Height")));
time_relations[shape->ID] = new_relation;
+ time_relations[shape->ID]->set_color(shape_color);
break;
}
@@ -814,6 +831,7 @@
// note: this shape is rotated by 90 degrees
new_comment->set_width(GetHeight(shape));
comments[shape->ID] = new_comment;
+ comments[shape->ID]->set_color(shape_color);
break;
}
case ST_TIME_ABSOLUTE:
@@ -825,6 +843,7 @@
//create absolute time interval
AbsoluteTimePtr abs = new AbsoluteTime(*(new MscTimeIntervalSet<double>(abs_s)));
+ abs->set_color(shape_color);
abs->set_position(GetLineEnd(shape));
// note: this shape is rotated by 90 degrees
abs->set_width(GetHeight(shape));
@@ -847,6 +866,7 @@
Comment* new_comment = new Comment((const wchar_t*)shape->Text);
new_comment->set_position(GetPinPos(shape));
new_comment->set_width(GetWidth(shape));
+ new_comment->set_color(shape_color);
bmsc->add_comment(new_comment);
break;
}
@@ -1223,6 +1243,7 @@
ipos->second->add_area(coregion_area = create_coregion_area(events, elements, shape));
coregion_area->set_begin_height(ConvertCoordinate(instance, epos->event_height));
coregion_area->set_width(shape->CellsSRC[visSectionObject][visRowXFormOut][visXFormHeight]->Result[visMillimeters]);
+ coregion_area->set_color(CShapeUtils::ExtractShapeColor(shape));
}
else
{
@@ -1634,6 +1655,7 @@
for(int i = 1; i <= vsoPage->Shapes->Count; i++)
{
Visio::IVShapePtr shape = vsoPage->Shapes->Item[i];
+ MscColor shape_color = CShapeUtils::ExtractShapeColor(shape);
try
{
@@ -1655,6 +1677,7 @@
new_comment->set_position(GetLineEnd(shape));
// note: this shape is rotated by 90 degrees
new_comment->set_width(GetHeight(shape));
+ new_comment->set_color(shape_color);
comments[shape->ID] = new_comment;
break;
}
@@ -1663,6 +1686,7 @@
Comment* new_comment = new Comment((const wchar_t*)shape->Text);
new_comment->set_position(GetPinPos(shape));
new_comment->set_width(GetWidth(shape));
+ new_comment->set_color(shape_color);
hmsc->add_comment(new_comment);
break;
}
@@ -1671,7 +1695,7 @@
{
ConnectionNode *new_connection = new ConnectionNode();
new_connection->set_position(GetPinPos(shape));
-
+ new_connection->set_color(shape_color);
hmsc->add_node(new_connection);
nodes[shape->ID] = new_connection;
break;
@@ -1688,6 +1712,7 @@
}
StartNode *new_start = new StartNode();
new_start->set_position(GetPinPos(shape));
+ new_start->set_color(shape_color);
hmsc->set_start(new_start);
nodes[shape->ID] = new_start;
@@ -1697,6 +1722,7 @@
{
EndNode *new_end = new EndNode();
new_end->set_position(GetPinPos(shape));
+ new_end->set_color(shape_color);
hmsc->add_node(new_end);
nodes[shape->ID] = new_end;
@@ -1706,6 +1732,7 @@
{
ReferenceNode *new_node = new ReferenceNode();
new_node->set_position(GetPinPos(shape));
+ new_node->set_color(shape_color);
hmsc->add_node(new_node);
nodes[shape->ID] = new_node;
@@ -1725,6 +1752,7 @@
{
ConditionNode *new_condition = new ConditionNode((const char*)shape->Text);
new_condition->set_position(GetPinPos(shape));
+ new_condition->set_color(shape_color);
hmsc->add_node(new_condition);
nodes[shape->ID] = new_condition;
@@ -1733,8 +1761,20 @@
case ST_HMSC_LINE:
case ST_HMSC_ARROW:
- relations[shape->ID] = new NodeRelation();
+ {
+ NodeRelation *new_node_relation = new NodeRelation();
+ new_node_relation->set_color(shape_color);
+ PolyLine line;
+ short rows = shape->RowCount[visSectionFirstComponent]-1;
+ for(short i = 2; i<rows; i++)
+ {
+ MscPoint point(shape->CellsSRC[visSectionFirstComponent][i][0]->Result[visMillimeters], shape->CellsSRC[visSectionFirstComponent][i][1]->Result[visMillimeters]);
+ line.push_back_point(point);
+ }
+ new_node_relation->set_line(line);
+ relations[shape->ID] = new_node_relation;
break;
+ }
case ST_TIME_INTERVAL:
//case ST_TIME_DIRECTED:
@@ -1742,6 +1782,7 @@
TimeRelationRefNode *new_relation = new TimeRelationRefNode((const char*)shape->Text);
//new_relation->set_directed(type == ST_TIME_DIRECTED);
new_relation->set_width(GetControlPos(shape, _T("Height")));
+ new_relation->set_color(shape_color);
time_relations[shape->ID] = new_relation;
break;
}
@@ -1794,6 +1835,7 @@
continue;
}
+
Visio::IVConnectPtr connect1 = line->Connects->Item[1];
Visio::IVShapePtr shape1 = connect1->ToSheet;
Modified: trunk/src/view/visio/addon/extract.h
===================================================================
--- trunk/src/view/visio/addon/extract.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/extract.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -215,6 +215,7 @@
};
InstancePtr new_instance_ptr(Visio::IVShapePtr shape);
+ InstancePtr new_instance_ptr(Visio::IVShapePtr shape, MscColor color);
//! process the given page and build a relevant BMsc
BMscPtr extract_bmsc(Visio::IVPagePtr vsoPage);
Modified: trunk/src/view/visio/addon/shapeutils.cpp
===================================================================
--- trunk/src/view/visio/addon/shapeutils.cpp 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/shapeutils.cpp 2013-12-05 14:13:49 UTC (rev 1878)
@@ -19,6 +19,7 @@
#include "messageSnapping.h"
#include "visualize.h"
#include "enumerateUtils.h"
+#include <sstream>
void CShapeUtils::GlueBeginConector(Visio::IVShapePtr connector, Visio::IVShapePtr coreg, const MscPoint& point)
{
@@ -127,6 +128,75 @@
}
}
+void CShapeUtils::ChangeShapeColor(Visio::IVShapePtr shape, MscElementPtr element)
+{
+ if(element->get_marked() == NONE)
+ {
+ ChangeShapeColor(shape, element->get_color());
+ }
+}
+
+void CShapeUtils::ChangeShapeColor(Visio::IVShapePtr shape, MscColor color)
+{
+
+ if (shape->Type == Visio::visTypeGroup)
+ {
+ for(long i = 1; i <= shape->Shapes->Count; i++)
+ {
+ ChangeShapeColor(shape->Shapes->Item[i], color);
+ }
+ }
+ if(color.getColor() >= 0)
+ {
+ // line color from MscColor struct
+ shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultIU = color.getColor();
+ // text color from MscColor struct
+ shape->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->ResultIU = color.getColor();
+ }
+ else
+ {
+ //set color from RGB
+ std::ostringstream color_str;
+ color_str << "RGB(" << color.getRed() << "," << color.getGreen() << "," << color.getBlue() << ")";
+ // line color from MscColor struct
+ shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->Formula = color_str.str().c_str();
+ // text color from MscColor struct
+ shape->CellsSRC[visSectionCharacter][visRowCharacter][visCharacterColor]->Formula = color_str.str().c_str();
+ }
+}
+
+MscColor CShapeUtils::ExtractShapeColor(Visio::IVShapePtr shape)
+{
+ MscColor result;
+ //store color ID for Visio
+ result.setColor(shape->CellsSRC[visSectionObject][visRowLine][visLineColor]->ResultIU);
+
+ Visio::IVCellPtr cell = shape->CellsSRC[visSectionObject][visRowLine][visLineColor];
+
+ BSTR str = cell->ResultStrU[visUnitsColor].GetBSTR();
+ wchar_t *endP;
+ //parse string RGB(r, g, b) into numbers r,g,b
+ endP = wcsstr(str,L"RGB");
+ if(endP!= NULL)
+ {
+ endP = wcstok(str,L"( "); //throw RGB away
+ endP = wcstok(NULL,L"( ");
+ int red = wcstol(endP,&endP,10);
+ endP = wcstok(NULL,L"( ");
+ int green = wcstol(endP,&endP,10);
+ endP = wcstok(NULL,L"( ");
+ int blue = wcstol(endP,&endP,10);
+ result.setColor(red,green,blue);
+ }
+ else
+ {
+ long color_index = wcstol(str,&endP,10);
+ Visio::IVColorPtr color = shape->Document->Colors->Item[color_index];
+ result.setColor(color->GetRed(), color->GetGreen(), color->GetBlue());
+ }
+ return result;
+}
+
void CShapeUtils::UnmarkShape(Visio::IVShapePtr shape)
{
MarkShape(shape, SC_BLACK);
Modified: trunk/src/view/visio/addon/shapeutils.h
===================================================================
--- trunk/src/view/visio/addon/shapeutils.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/shapeutils.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -55,6 +55,15 @@
static void UnmarkShape(Visio::IVShapePtr shape);
/**
+ * Shape color
+ * @param shape the shape to be colored
+ * @param color the color the shape will be colored with
+ */
+ static void ChangeShapeColor(Visio::IVShapePtr shape, MscElementPtr element);
+ static void ChangeShapeColor(Visio::IVShapePtr shape, MscColor color);
+ static MscColor CShapeUtils::ExtractShapeColor(Visio::IVShapePtr shape);
+
+ /**
* Get a coregion connected to shape, crossing yPos.
* @param shape the shape on which to find a coregion
* @param yPos the Y-position relative to the page in internal units
Modified: trunk/src/view/visio/addon/visualize.cpp
===================================================================
--- trunk/src/view/visio/addon/visualize.cpp 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/visualize.cpp 2013-12-05 14:13:49 UTC (rev 1878)
@@ -19,8 +19,8 @@
#include "stdafx.h"
#include "dllmodule.h"
#include "document.h"
+#include "visualize.h"
#include "extract.h"
-#include "visualize.h"
#include "errors.h"
#include "data/msc/CoregionArea.h"
@@ -284,6 +284,10 @@
case REMOVED: CShapeUtils::MarkShape(shape, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if(element->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(shape, element->get_color());
+ }
if (boost::dynamic_pointer_cast<MscMessage>(element) != NULL)
shape->Text = boost::dynamic_pointer_cast<MscMessage>(element)->get_label().c_str();
@@ -309,7 +313,7 @@
if(complete_message != NULL)
{
Visio::IVShapePtr msg = drop_shape(vsoPage, shapes, complete_message, find_master(ST_BMSC_MESSAGE));
-
+
if(complete_message->get_send_event() == event)
CShapeUtils::GlueBeginToPos(msg, parent, event->get_position());
else if(complete_message->get_receive_event() == event)
@@ -383,6 +387,7 @@
CShapeUtils::GlueBeginToPos(comment, parent, event->get_position());
SetLineEnd(comment, (*cpos)->get_position());
+
}
AbsoluteTimePtrList at_list = event->get_absolut_times();
@@ -420,7 +425,7 @@
else
connector->CellsSRC[visSectionControls][visRowControl][visCtlX]->Result[visMillimeters] = -5.0;
}
-
+
return connector;
}
@@ -449,6 +454,10 @@
case NOT_FULL_COVER: CShapeUtils::MarkShape(result, SC_BLUE); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if(time_relation->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(result, time_relation->get_color());
+ }
result->Text = time_relation->get_label().c_str();
@@ -508,6 +517,12 @@
case REMOVED: CShapeUtils::MarkShape(text, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+
+ if((*cpos)->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(text, (*cpos)->get_color());
+ }
+
}
BMscPtr bmsc = boost::dynamic_pointer_cast<BMsc>(msc);
@@ -538,6 +553,10 @@
case REMOVED: CShapeUtils::MarkShape(inst, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if((*ipos)->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(inst, (*ipos)->get_color());
+ }
inst->Text = (*ipos)->get_label().c_str();
SetControlPos(inst, _T("mscHeadWidth"), (*ipos)->get_width()/2.0);
@@ -588,6 +607,10 @@
case REMOVED: CShapeUtils::MarkShape(coregion, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if(coregion_area->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(coregion, coregion_area->get_color());
+ }
CShapeUtils::GlueBeginToPos(coregion, inst, MscPoint(0,coregion_area->get_begin_height()));
CShapeUtils::GlueEndToPos(coregion, inst, MscPoint(0,coregion_area->get_end_height()));
@@ -633,6 +656,11 @@
case REMOVED: CShapeUtils::MarkShape(connector, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if((*spos)->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(connector, (*spos)->get_color());
+ }
+
}
}
}
@@ -662,9 +690,9 @@
shape = vsoPage->Drop(find_master(ST_MSC_CONDITION), 0, 0);
// move shape to the right position
shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX]->Result[visMillimeters] = condition_node->get_position().get_x();
- shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[visMillimeters] = page_height - condition_node->get_position().get_y();
+ shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginY]->Result[visMillimeters] = page_height - condition_node->get_position().get_y() + 5;
shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndX]->Result[visMillimeters] = condition_node->get_position().get_x();
- shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[visMillimeters] = page_height - condition_node->get_position().get_y() - 10;
+ shape->CellsSRC[visSectionObject][visRowXForm1D][vis1DEndY]->Result[visMillimeters] = page_height - condition_node->get_position().get_y() - 5;
shape->Text = condition_node->get_label().c_str();
}
@@ -704,6 +732,10 @@
case PATH: CShapeUtils::MarkShape(shape, SC_DARK_GREEN); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if(node->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(shape, node->get_color());
+ }
nodes[node] = shape;
@@ -799,6 +831,10 @@
case PATH: CShapeUtils::MarkShape(connector, SC_DARK_GREEN); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if( (*spos)->get_marked() == NONE )
+ {
+ CShapeUtils::ChangeShapeColor(connector, (*spos)->get_color());
+ }
Visio::IVCellPtr from_cell = connector->CellsSRC[visSectionObject][visRowXForm1D][vis1DBeginX];
if(get_shape_type(shape) == ST_MSC_CONDITION)
{
@@ -817,7 +853,7 @@
{
to_cell->GlueToPos(successor_shape, 0.5, 1.0);
}
-
+
// add successors of this node to the stack
// note: std::list<>::push_back doesn't invalidate iterators
push_back_if_unique<HMscNodePtr>(node_stack, successor_node);
@@ -860,6 +896,10 @@
default: throw std::runtime_error("Error: unexpected behaviour");
}
// CShapeUtils::MarkShape(commentShape);
+ if(reference_node->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(commentShape, reference_node->get_color());
+ }
}
}
}
Modified: trunk/src/view/visio/addon/visualize.h
===================================================================
--- trunk/src/view/visio/addon/visualize.h 2013-11-28 23:27:31 UTC (rev 1877)
+++ trunk/src/view/visio/addon/visualize.h 2013-12-05 14:13:49 UTC (rev 1878)
@@ -90,7 +90,11 @@
case REMOVED: CShapeUtils::MarkShape(result, SC_RED); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
-
+ if(comment->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(result, comment->get_color());
+ }
+
return result;
}
@@ -110,6 +114,10 @@
case NOT_FULL_COVER: CShapeUtils::MarkShape(result, SC_BLUE); break;
default: throw std::runtime_error("Error: unexpected behaviour");
}
+ if(at->get_marked() == NONE)
+ {
+ CShapeUtils::ChangeShapeColor(result, at->get_color());
+ }
return result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|