Hello,
I;m trying to attach a raster image to a file but I'm not sure what I'm doing is correct or not. So, I started with basics and developing slowly.
So, first I tried to attach the raster to active model. This works fine but there is something that I noticed is that I need to open raster manager then run my app to attach the image. This is what I have and it worked for adding raster to active model:
int main(int argc, char *argv[]) { long rasterHandle; RasterExtendedInfo extendedInfo; if(mdlRaster_fileOpen (&rasterHandle, "c:\\temp\\38O17Q14.tif", mdlModelRef_getActive(), FILE_ACCESSMODE_READ, EVENT_UPDATE)==SUCCESS){ mdlDialog_openInfoBox("Raster attached successfully"); } mdlRaster_renderingInfoGet(&renderingInfo,rasterHandle); renderingInfo.view1=1; mdlRaster_renderingInfoSet(&renderingInfo,rasterHandle,EVENT_UPDATE); mdlState_startDefaultCommand(); mdlSystem_exit(NULL, 1); return 0; }
Do I need to change any part of this code so that I don't need to open raster manager and then run the app?
I will then tried to attach raster image to another file that is not open but I'm failing to do so. I tried to open the file or create the file and reference that file for attaching raster image but neither worked.
nt main(int argc, char *argv[]) { long rasterHandle; RasterExtendedInfo extendedInfo; //open an exiting DGN file /* if(mdlWorkDgn_openFile(&pModelRef, &pFormat, FALSE, "c:\\temp\\test.dgn", NULL, FALSE)==SUCCESS){ mdlDialog_openInfoBox("WorkDgn opened successfully"); } */ //create new DGN file if(mdlWorkDgn_createFile(&pModelRef, "c:\\temp\\test.dgn", pFormat, MASTERFILE, SEED_CopyTCB, NULL, NULL, FALSE)==SUCCESS){ mdlDialog_openInfoBox("WorkDgn created successfully"); } mdlRaster_initialize(); //command bellow returns SUCCESS if(mdlRaster_fileOpen(&rasterHandle, "c:\\temp\\38O17Q14.tif", &pModelRef, FILE_ACCESSMODE_READ, EVENT_UPDATE)==SUCCESS){ mdlDialog_openInfoBox("Raster added successfully"); } //This part should be responsible for displaying raster on the model but need to figure out how to apply this to the file referenced above mdlRaster_renderingInfoGet(&renderingInfo,rasterHandle); renderingInfo.view1=1; mdlRaster_renderingInfoSet(&renderingInfo,rasterHandle,EVENT_UPDATE); mdlWorkDgn_saveChanges (pModelRef); mdlWorkDgn_closeFile(pModelRef); mdlState_startDefaultCommand(); mdlSystem_exit(NULL, 1); return 0; }
Ideally, I want to be able to attach raster to multiple files without having to do it one by one. Can you guide me on how I can achieve that? Is element descriptor a fine approach for this task?
Regards,
Mo