Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Company::Wrappers::CompanyDevicePhMgd::SetStructureVectors()
- {
- CompanyDevicePh * device = GetImpObj();
- device->vSconnections.clear();
- for(int i = 0 ; i < vSconnections->Count ; i++)
- {
- StraightConnection connection;
- AcDbHandle handle(vSconnections[i]->HandlePlume.Value);
- connection.HandlePlume = handle;
- connection.Priority = vSconnections[i]->Priority;
- device->vSconnections.push_back(connection);
- }
- device->StraightConnectionSize = vSconnections->Count;
- device->vPlumesCoords.clear();
- for(int i = 0 ; i < vPlumesCoords->Count ; i++)
- {
- PlumePositionInformation inf;
- AcDbHandle handle(vPlumesCoords[i]->PlumeHandle.Value);
- inf.PlumeHandle = handle;
- inf.Id = vPlumesCoords[i]->Id;
- inf.Position = vPlumesCoords[i]->Position;
- inf.ConnectedWithBase = vPlumesCoords[i]->ConnectedWithBase;
- inf.IsStraight = vPlumesCoords[i]->IsStraight;
- inf.SideDevicesSize = vPlumesCoords[i]->SideDevices->Count;
- for(int j = 0 ; j < vPlumesCoords[i]->SideDevices->Count ; j++)
- {
- AcDbHandle firstHandle(vPlumesCoords[i]->SideDevices[j]->Key.Value);
- AcDbHandle secondHandle(vPlumesCoords[i]->SideDevices[j]->Value.Value);
- SideDevicesInfo pair;
- pair.Key = firstHandle;
- pair.Value = secondHandle;
- for(int z = 0; z< vPlumesCoords[i]->SideDevices[j]->PlugInfo->Count; z++)
- {
- TerminalInfo newInf;
- TerminalInfoMgd ^ etalonInfo = vPlumesCoords[i]->SideDevices[j]->PlugInfo[z];
- newInf.FirstDevContactId = etalonInfo->FirstDevContactId;
- newInf.FirstDeviceTerminalId = etalonInfo->FirstDeviceTerminalId;
- newInf.SecDevContactId = etalonInfo->SecDevContactId;
- newInf.SecondDeviceTerminalId = etalonInfo->SecondDeviceTerminalId;
- pair.PlugInfo.push_back(newInf);
- }
- pair.plugInfoSize = vPlumesCoords[i]->SideDevices[j]->PlugInfo->Count;
- inf.SideDevices.push_back(pair);
- }
- device->vPlumesCoords.push_back(inf);
- }
- device->PlumeCoordsSize = vPlumesCoords->Count;
- device->vProperties.clear();
- DWORD err;
- for(int i = 0 ; i < vProperties->Count ; i++)
- {
- Property prop;
- /*prop.Name = new wchar_t[100];
- prop.Name[0] = L'\0';
- wcscat(prop.Name,MStringToWchar(vProperties[i]->Name));*/
- //delete prop.Name;
- if(prop.Name != NULL)
- delete [] prop.Name;
- prop.Name = new wchar_t[100];
- //err = GetLastError();
- MStringToWchar(vProperties[i]->Name,prop.Name);
- prop.NameLen = wcslen(prop.Name);
- switch(vProperties[i]->Type)
- {
- case doubleType :
- prop.Type = ValType::doubleType;
- prop.DoubleVal = vProperties[i]->DoubleVal;
- prop.IntVal = -1;
- prop.StrValLen = -1;
- break;
- case intType:
- prop.Type = ValType::intType;
- prop.IntVal = vProperties[i]->IntVal;
- prop.DoubleVal = -1;
- prop.StrValLen = -1;
- break;
- case stringType:
- prop.Type = ValType::stringType;
- //delete prop.StrVal;
- if(prop.StrVal != NULL)
- delete [] prop.StrVal;
- prop.StrVal = new wchar_t[50];
- //err = GetLastError();
- MStringToWchar(vProperties[i]->StrVal,prop.StrVal);
- /*prop.StrVal = new wchar_t[100];
- prop.StrVal[0] = L'\0';
- wcscat(prop.StrVal, MStringToWchar(vProperties[i]->StrVal));*/
- prop.StrValLen = wcslen(prop.StrVal);
- prop.DoubleVal = -1;
- prop.IntVal = -1;
- break;
- }
- device->vProperties.push_back(prop);
- }
- device->vTerminals.clear();
- for(int i = 0 ; i < vTerminals->Count ; i++)
- {
- Terminal terminal;
- terminal.Id = vTerminals[i]->Id;
- terminal.isConnected = vTerminals[i]->isConnected;
- terminal.ContactsSize = vTerminals[i]->vContacts->Count;
- terminal.SectionArea = vTerminals[i]->SectionArea;
- //delete terminal.Name;
- terminal.Name = new wchar_t[50];
- err = GetLastError();
- MStringToWchar(vTerminals[i]->Name,terminal.Name);
- terminal.namelen = wcslen(terminal.Name);
- for(int b = 0; b < terminal.namelen;b++)
- {
- terminal.Test[b] = terminal.Name[b];
- }
- terminal.Type = new wchar_t[50];
- acutPrintf(L"%p %p",terminal.Type,terminal.Name);
- err = GetLastError();
- MStringToWchar(vTerminals[i]->Type,terminal.Type);
- terminal.TypeLen = wcslen(terminal.Type);
- for(int j = 0 ; j < vTerminals[i]->vContacts->Count ; j++)
- {
- Contact contact;
- ///////allocation here
- contact.ContactName = new wchar_t[50];
- contact.TypeName = new wchar_t[50];
- contact.IsConnected = vTerminals[i]->vContacts[j]->IsConnected;
- contact.Id = vTerminals[i]->vContacts[j]->Id;
- MStringToWchar(vTerminals[i]->vContacts[j]->ContactName,contact.ContactName);
- MStringToWchar(vTerminals[i]->vContacts[j]->TypeName,contact.TypeName);
- contact.namelen = wcslen(contact.ContactName);
- contact.TypeNameLen = wcslen(contact.TypeName);
- contact.ContactNumber = vTerminals[i]->vContacts[j]->ContactNumber;
- for(int b = 0 ; b < vTerminals[i]->vContacts[j]->ConnectionInfo->Count; b++)
- {
- MgdContactConnectionInfo ^ etInf = vTerminals[i]->vContacts[j]->ConnectionInfo[b];
- ContactConnectionInfo nativeInf;
- nativeInf.ContactId = etInf->ContactId;
- nativeInf.TerminalId = etInf->TerminalId;
- AcDbHandle shandle(etInf->SwitchingDevice.Value);
- nativeInf.SwitchingDevice = shandle;
- contact.ConnectionInfo.push_back(nativeInf);
- }
- contact.ConnectionsSize = contact.ConnectionInfo.size();
- terminal.vContacts.push_back(contact);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement