osg::Matrixd NodePathUtils::getLocalToWindowTransform(const osg::NodePath& path, bool ignorecameras) { osg::Camera* cam = getLastCamera(path); if (cam->getViewport()) return getLocalToViewportTransform(cam->getViewport(), path, ignorecameras); else { // diese camera hat keinen viewport, deswegen die erste Kamera ŸberprŸfen, ob diese einen hat, und diesn benutzen osg::Camera* firstcam = getFirstCamera(path); if (firstcam->getViewport()) return getLocalToViewportTransform(firstcam->getViewport(), path, ignorecameras); } return getLocalToViewportTransform(NULL, path, ignorecameras);; }
int CanonEDCamera::Initialize() { EdsError err = EDS_ERR_OK; // Initialize SDK err = EdsInitializeSDK(); if(err == EDS_ERR_OK) { isSDKLoaded_ = true; } // Get first camera if(err == EDS_ERR_OK) { err = getFirstCamera (&camera_); } if (err == EDS_ERR_DEVICE_NOT_FOUND) return ERR_NO_CAMERA; // event handlers are static functions that need a reference to this camera object to function // provide that static ref here. This approach will fail with multiple cameras. In that case, // consider making a map with cameras and references to our CanonEDCamera objects g_Self = this; // Set event handler if(err == EDS_ERR_OK) { err = EdsSetObjectEventHandler(camera_, kEdsObjectEvent_All, &CanonEDCamera::handleObjectEvent, NULL); } // Set event handler if(err == EDS_ERR_OK) { err = EdsSetPropertyEventHandler(camera_, kEdsPropertyEvent_All, &CanonEDCamera::handlePropertyEvent, NULL); } // Set event handler if(err == EDS_ERR_OK) { err = EdsSetCameraStateEventHandler(camera_, kEdsStateEvent_All, &CanonEDCamera::handleStateEvent, NULL); } if(err == EDS_ERR_OK) { err = EdsOpenSession(camera_); } // Camera name if (err == EDS_ERR_OK) { EdsDeviceInfo deviceInfo; err = EdsGetDeviceInfo(camera_, &deviceInfo); if (err == EDS_ERR_OK) { std::ostringstream os; os << "Canon SLR device subtype: " << deviceInfo.deviceSubType; LogMessage(os.str().c_str()); if (deviceInfo.deviceSubType == 0) isLegacy_ = true; cameraModel_ = deviceInfo.szDeviceDescription; int nRet = CreateProperty("Model", cameraModel_.c_str(), MM::String, true); if (nRet != DEVICE_OK) return nRet; } // Set and Get various camera properties // lock the UI before setting properties - only needed on legacy cameras if (isLegacy_) EdsSendStatusCommand (camera_, kEdsCameraStatusCommand_UILock, 0); EdsSaveTo toPC = kEdsSaveTo_Host; err = EdsSetPropertyData(camera_, kEdsPropID_SaveTo, 0 , sizeof(EdsSaveTo), &toPC); if (isLegacy_) EdsSendStatusCommand (camera_, kEdsCameraStatusCommand_UIUnLock, 0); } if (err == EDS_ERR_OK) { CPropertyAction* pAct = new CPropertyAction(this, &CanonEDCamera::OnBinning); int nRet = CreateProperty(MM::g_Keyword_Binning, "1", MM::Integer, false, pAct); if (nRet != DEVICE_OK) return nRet; } if (err == EDS_ERR_OK) { return DEVICE_OK; } std::ostringstream os; os << "Error during initialization: " << std::hex << err; LogMessage(os.str().c_str()); return err; }