}
+//=========================================================================
+void wxVtkSceneManager::getCleanLine(stringstream &inputStream, std::string &line)
+{
+ getline(inputStream, line,'\n');
+ int size = line.length();
+ if ( line[ size-1 ]==13 )
+ {
+ line.erase(size-1,1);
+ }
+}
+
//=========================================================================
-void wxVtkSceneManager::loadDiagram(stringstream &inputStream) {
-
+void wxVtkSceneManager::loadDiagram(stringstream &inputStream)
+{
+ int size;
std::string version = "<void>";
std::string line = "";
char delims[] = ":";
char *result = NULL;
- getline(inputStream, line);
+ getCleanLine(inputStream, line);
bool start = false;
while (!inputStream.eof()) {
if (line == "" || line[0] == '#') {
- getline(inputStream, line);
+ line="";
+ getCleanLine(inputStream, line);
+
if (line == "# - BBTKGEditor v 1.0 BBG BlackBox Diagram file") {
version = line.substr(18, 3);
}
}
}
- printf("EED wxVtkSceneManager::loadDiagram version=%s\n", version.c_str());
if (start) {
if ((version != "1.0") && (version != "1.1")) {
- getline(inputStream, line);//CATEGORY:<category of the box>
+ getCleanLine(inputStream, line);//CATEGORY:<category of the box>
char categoryTmp[30];
strcpy(categoryTmp, line.c_str());
result = strtok(categoryTmp, delims);
result = strtok(NULL, delims);
SetCategory(result);
- getline(inputStream, line);//DESCRIPTION:<description of the box>
+ getCleanLine(inputStream, line);//DESCRIPTION:<description of the box>
char descriptionTmp[1024];
strcpy(descriptionTmp, line.c_str());
result = strtok(descriptionTmp, delims);
result = strtok(NULL, delims);
SetDescription(result);
- getline(inputStream, line);//AUTHOR:<author>
+ getCleanLine(inputStream, line);//AUTHOR:<author>
char authorTmp[255];
strcpy(authorTmp, line.c_str());
result = strtok(authorTmp, delims);
}
//----------
- getline(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
+ getCleanLine(inputStream, line);//COMPLEX_BOX:TRUE|FALSE
char complexTmp[30];
strcpy(complexTmp, line.c_str());
result = strtok(complexTmp, delims);
_isComplexBox = true;
if ((version != "1.0") && (version != "1.1")) {
- getline(inputStream, line);//COMPLEXNAME:<name of the complex box>
+ getCleanLine(inputStream, line);//COMPLEXNAME:<name of the complex box>
char complexboxnameTmp[255];
strcpy(complexboxnameTmp, line.c_str());
result = strtok(complexboxnameTmp, delims);
result = strtok(NULL, delims);
SetCbName(result);
- getline(inputStream, line);//PACKAGENAME:<name of the package of the box>
+ getCleanLine(inputStream, line);//PACKAGENAME:<name of the package of the box>
char packagenameTmp[255];
strcpy(packagenameTmp, line.c_str());
result = strtok(packagenameTmp, delims);
//-----------------------
//- COMPLEX INPUT PORTS
//-----------------------
- getline(inputStream, line);//COMPLEXINPUTS:num
+ getCleanLine(inputStream, line);//COMPLEXINPUTS:num
char inputs[30];
strcpy(inputs, line.c_str());
result = strtok(inputs, delims);
for (int i = 0; i < numInputs; i++) {
//----------
- getline(inputStream, line);//COMPLEX_PORT
- getline(inputStream, line);//name
+ getCleanLine(inputStream, line);//COMPLEX_PORT
+ getCleanLine(inputStream, line);//name
std::string inputPortName(line);
//----------
- getline(inputStream, line);//xInic:yInic:zInic
+ getCleanLine(inputStream, line);//xInic:yInic:zInic
char coord[80];
strcpy(coord, line.c_str());
result = strtok(coord, delims);//xInic
if (zIn==900) zIn=GPOSITION_Z;
}
- getline(inputStream, line);//FIN_COMPLEX_PORT
+ getCleanLine(inputStream, line);//FIN_COMPLEX_PORT
configGComBoxInputOutputPort(true, inputPortName, xIn, yIn, zIn);
//- COMPLEX OUTPUT PORTS
//-----------------------
- getline(inputStream, line);//COMPLEXOUTPUTS:num
+ getCleanLine(inputStream, line);//COMPLEXOUTPUTS:num
char outputs[30];
strcpy(outputs, line.c_str());
result = strtok(outputs, delims);
for (int i = 0; i < numOutputs; i++) {
//----------
- getline(inputStream, line);//COMPLEX_PORT
- getline(inputStream, line);//name
+ getCleanLine(inputStream, line);//COMPLEX_PORT
+ getCleanLine(inputStream, line);//name
std::string outputPortName(line);
//----------
- getline(inputStream, line);//xInic:yInic:zInic
+ getCleanLine(inputStream, line);//xInic:yInic:zInic
char coord[80];
strcpy(coord, line.c_str());
result = strtok(coord, delims);//xInic
if (zIn==900) zIn=GPOSITION_Z;
}
- getline(inputStream, line);//FIN_COMPLEX_PORT
+ getCleanLine(inputStream, line);//FIN_COMPLEX_PORT
configGComBoxInputOutputPort(false, outputPortName, xIn, yIn, zIn);
} // complex box
//----------
- getline(inputStream, line);//BOXES:num
+ getCleanLine(inputStream, line);//BOXES:num
char boxes[9];
strcpy(boxes, line.c_str());
result = strtok(boxes, delims);
for (int i = 0; i < numBoxes; i++) {
//----------
- getline(inputStream, line);//BOX
- getline(inputStream, line);//package:type:name
+ getCleanLine(inputStream, line);//BOX
+ getCleanLine(inputStream, line);//package:type:name
char box[150];
strcpy(box, line.c_str());
result = strtok(box, delims);//package
result = strtok(NULL, delims);//name
std::string name(result);
- getline(inputStream, line);//ISEXEC:TRUE|FALSE
+ getCleanLine(inputStream, line);//ISEXEC:TRUE|FALSE
char exec[15];
strcpy(exec, line.c_str());
result = strtok(exec, delims);//ISEXEC
std::string isExec(result);
//----------
- getline(inputStream, line);//xInic:yInic:zInic
+ getCleanLine(inputStream, line);//xInic:yInic:zInic
char coord[80];
strcpy(coord, line.c_str());
result = strtok(coord, delims);//xInic
//----------
- getline(inputStream, line);//xEnd:yEnd:zEnd
+ getCleanLine(inputStream, line);//xEnd:yEnd:zEnd
strcpy(coord, line.c_str());
result = strtok(coord, delims);//xEnd
std::string xEnd(result);
GBlackBoxModel *bbmod = (GBlackBoxModel*) cont->getModel();
//----------
- getline(inputStream, line);//PORT o FIN_BOX
+ getCleanLine(inputStream, line);//PORT o FIN_BOX
std::string port = line.substr(0, 4);
while (port == "PORT") {
- getline(inputStream, line);//name:value
+ getCleanLine(inputStream, line);//name:value
char poort[150];
strcpy(poort, line.c_str());
result = strtok(poort, delims);//name
bbmod->setValueToInput(name, value);
- getline(inputStream, line);//PORT o FIN_BOX
+ getCleanLine(inputStream, line);//PORT o FIN_BOX
port = line.substr(0, 4);
} // while
/// CONNECTIONS
//----------
- getline(inputStream, line);//CONNECTIONS:num
+ getCleanLine(inputStream, line);//CONNECTIONS:num
char conns[30];
strcpy(conns, line.c_str());
result = strtok(conns, delims);
int numConns;
std::istringstream isCons(result);
isCons >> numConns;
-
+
+
for (int i = 0; i < numConns; i++) {
//----------
- getline(inputStream, line);//CONNECTION
- getline(inputStream, line);//Startbox.PortName:EndBox.PortName
+ getCleanLine(inputStream, line);//CONNECTION
+ getCleanLine(inputStream, line);//Startbox.PortName:EndBox.PortName
char connec[200];
strcpy(connec, line.c_str());
GConnectorController *tempp = (GConnectorController*) _controllers[idCon];
GConnectorModel *conMod = (GConnectorModel*) tempp->getModel();
vtkGConnectorView *conView = (vtkGConnectorView*) tempp->getView();
- getline(inputStream, line); //NumberOfControlPoints:##
+ getCleanLine(inputStream, line); //NumberOfControlPoints:##
strcpy(conns, line.c_str());
result = strtok(conns, delims);
result = strtok(NULL, delims);
isCons >> numberOfControlPoints;
for (int ii = 0; ii < numberOfControlPoints; ii++) {
- getline(inputStream, line); //XX:YY:ZZ
+ getCleanLine(inputStream, line); //XX:YY:ZZ
char connec[200];
strcpy(connec, line.c_str());