Example #1
0
void DlgEdit::DoEditChange()
{
	auto dialog=GetDialog();
	_DIALOG(CleverSysLog CL(L"DlgEdit::DoEditChange()"));
	_DIALOG(SysLog(L"m_Owner=%p, m_Owner->IsInited()=%d, m_Index=%d",dialog,dialog->IsInited(),m_Index));
	if (dialog->IsInited())
	{
		dialog->SendMessage(DN_EDITCHANGE,m_Index,0);
	}
}
Example #2
0
VisualOdometry::VisualOdometry(const VisualOdometryConfig &config)
    : status_(UNINITED),
      plot_tracking_(true),
      tracking_wait_time_(10),
      tracking_or_matching_(0),
      plot_3d_landmarks_(true),
      plot_3d_landmarks_every_frame_(1) {
  camera_model_ = new CameraModel(config.camera_model_params);

  FeatureMatcher *matcher =
      FeatureMatcher::CreateFeatureMatcher(config.feature_matcher_option);

  feature_tracker_ = FeatureTracker::CreateFeatureTracker(
      config.feature_tracker_option, matcher);
  map_initializer_ =
      MapInitializer::CreateMapInitializer(config.map_initializer_option);

  pnp_estimator_ = PnPEstimator::CreatePnPEstimator(ITERATIVE);
  optimizer_ = GraphOptimizer::CreateGraphOptimizer(vio::CERES);

  if (IsInited()) status_ = INITED;

  optimize_every_frame_ = config.optimize_every_frame;

  plot_tracking_ = config.viz_tracking;
  tracking_wait_time_ = config.viz_time_per_frame;

  plot_3d_landmarks_ = config.viz_landmarks;
  plot_3d_landmarks_every_frame_ = config.viz_landmarks_every_frame;
}
Example #3
0
bool WDbgArkColorHack::SetColor(const std::string &dml_name, const COLORREF color) {
    if ( !IsInited() ) {
        err << wa::showminus << __FUNCTION__ << ": class is not initialized" << endlerr;
        return false;
    }

    vecUiColor::iterator it = std::find_if(m_internal_colors.begin(),
                                           m_internal_colors.end(),
                                           [&dml_name](const InternalUiColor &ui_color) {
                                               return ui_color.dml_name == dml_name; });

    if ( it != m_internal_colors.end() ) {
        // do not touch original color
        it->new_color = color;
        // memory modification
        InterlockedExchange(&it->ui_color->color, static_cast<LONG>(color));
        // memory modification
        InterlockedExchange(&it->ui_color->int_color, static_cast<LONG>(color));
        it->is_changed = true;

        return true;
    }

    return false;
}
Example #4
0
bool WDbgArkColorHack::SetTheme(const std::string &theme_name) {
    if ( !IsInited() ) {
        err << wa::showminus << __FUNCTION__ << ": class is not initialized" << endlerr;
        return false;
    }

    if ( m_cur_theme == theme_name )
        return true;

    themes::const_iterator it = m_themes.find(theme_name);

    if ( it == m_themes.end() ) {
        err << wa::showminus << __FUNCTION__ << ": failed to find theme " << theme_name << endlerr;
        return false;
    }

    theme_elems elems = it->second;

    for ( const auto &element : elems ) {
        if ( !SetColor(element.first, element.second) ) {
            err << wa::showminus << __FUNCTION__ << ": failed to set new color for " << element.first << endlerr;
            RevertColors();
            return false;
        }
    }

    m_cur_theme = theme_name;
    return true;
}
Example #5
0
void WDbgArkColorHack::RevertColors(void) {
    if ( !IsInited() ) {
        err << wa::showminus << __FUNCTION__ << ": class is not initialized" << endlerr;
        return;
    }

    try {
        for ( auto &internal_color : m_internal_colors ) {
            if ( internal_color.is_changed ) {
                InterlockedExchange(&(internal_color.ui_color->color),
                                    static_cast<LONG>(internal_color.orig_color));

                InterlockedExchange(&(internal_color.ui_color->int_color),
                                    static_cast<LONG>(internal_color.orig_int_color));

                internal_color.new_color = internal_color.new_int_color = RGB(0, 0, 0);
                internal_color.is_changed = false;
            }
        }
    }
    catch( ... ) {
        err << wa::showminus << __FUNCTION__ << ": exception error" << endlerr;
    }

    m_cur_theme.clear();
}
Example #6
0
// Returns
//   true if Initialisation sucessful, false otherwise.
// Description
//   Initialises COM and creates an instance of the voice COM class.
//   Registers interest for all the events associated with the voice COM class.
bool WindowsSAPI5Narrator::Initialize(void)
{
	if(IsInited())
		return true;

	Error(TEXT(""));	
	
	//sapi init
	HRESULT hr = S_OK;		

	if( SUCCEEDED( hr ) )
	{
		hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&m_cpVoice);
	}
	else
	{
		return false;
	}

    // We're interested in all TTS events
    if( SUCCEEDED( hr ) )
    {
        hr = m_cpVoice->SetInterest( SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS );
    }	
	else
	{
		return false;
	}
	bInited = true;
	return true;
}
Example #7
0
void CPageAntispamSink::OnInit()
{
	if( !IsInited() )
	{
		Show("CAlgo", false);
		Show("CA_Line", false);
		Show("CAlgoGroup", false);

#if _BASEGUI_VER >= 0x0200
		Item()->AddDataSource(&m_Status);
#else
		m_pBinding->AddDataSource(&m_Status);
#endif
	}

#if _BASEGUI_VER >= 0x0200
#else
	if( CComboItem *pCombo = (CComboItem *)GetItem("CS_Action", GUI_ITEMT_COMBO) )
		pCombo->Fill("AS_Actions");
	if( CComboItem *pCombo = (CComboItem *)GetItem("PS_Action", GUI_ITEMT_COMBO) )
		pCombo->Fill("AS_Actions");
#endif

	UpdateStatus();
	TBaseDlg::OnInit();
}
Example #8
0
TrackingStatus VisualOdometry::TrackNewRawImage(const cv::Mat &img,
                                                FramePose &pose) {
  if (!IsInited()) return ERROR;

  std::unique_ptr<ImageFrame> frame(new ImageFrame(img));

  // If no image has been added.
  if (map_.state() == Mapdata::WAIT_FOR_FIRSTFRAME) {
    AddFirstFrame(std::move(frame));
    return TRACKING_NOT_AVAILABLE;
  }

  if (!AddNewFrame(std::move(frame))) return ERROR;

  // TODO: Move initialization out of mapdata, map should only save mapped data.
  // TODO: Put frames before initialization in a temporary vector.
  if (map_.state() == Mapdata::WAIT_FOR_INIT) {
    if (!InitializeLandmarks()) return ERROR;
  }

  if (map_.state() == Mapdata::INITIALIZED) {
    pose = map_.GetLastKeyframe().pose();
  }

  return TRACKING_NOT_AVAILABLE;
}
Example #9
0
bool Base::Init()
//---------------
{
	if(IsInited())
	{
		return true;
	}
	m_Caps = InternalGetDeviceCaps();
	return m_Caps.Available;
}
Example #10
0
bool WDbgArk::Init() {
    if ( IsInited() )
        return true;

    if ( m_Client->QueryInterface(__uuidof(IDebugSymbols3), reinterpret_cast<void**>(&m_symbols3_iface)) != S_OK ) {
        m_symbols3_iface.Set(nullptr);
        err << wa::showminus << __FUNCTION__ << ": Failed to initialize interface" << endlerr;
    }

    m_is_cur_machine64 = IsCurMachine64();

    // get system version
    m_system_ver.reset(new WDbgArkSystemVer);

    if ( !m_system_ver->IsInited() ) {
        err << wa::showminus << __FUNCTION__ ": WDbgArkSystemVer init failed" << endlerr;
        return false;
    } else {
        m_system_ver->CheckWindowsBuild();
    }

    m_Symbols->Reload("");  // revise debuggee modules list

    m_symbols_base.reset(new WDbgArkSymbolsBase);

    if ( !m_symbols_base->CheckMsSymbolsPath() )
        warn << wa::showqmark << __FUNCTION__ ": CheckMsSymbolsPath failed" << endlwarn;

    // it's a bad idea to do this in constructor's initialization list 'coz global class uninitialized
    m_obj_helper.reset(new WDbgArkObjHelper(m_sym_cache));

    if ( !m_obj_helper->IsInited() )
        warn << wa::showqmark << __FUNCTION__ ": WDbgArkObjHelper init failed" << endlwarn;

    m_color_hack.reset(new WDbgArkColorHack);

    if ( !m_color_hack->IsInited() )
        warn << wa::showqmark << __FUNCTION__ ": WDbgArkColorHack init failed" << endlwarn;

    m_dummy_pdb.reset(new WDbgArkDummyPdb);

    if ( !m_dummy_pdb->IsInited() )
        warn << wa::showqmark << __FUNCTION__ ": WDbgArkDummyPdb init failed" << endlwarn;

    InitScanCommands();
    InitCallbackCommands();

    if ( m_system_ver->GetStrictVer() >= W7RTM_VER && !FindDbgkLkmdCallbackArray() )
        warn << wa::showqmark << __FUNCTION__ ": FindDbgkLkmdCallbackArray failed" << endlwarn;

    if ( m_system_ver->GetStrictVer() >= W10RTM_VER && !FindMiApiSetSchema() )
        warn << wa::showqmark << __FUNCTION__ ": FindMiApiSetSchema failed" << endlwarn;

    return (m_inited = true);
}
Example #11
0
bool WDbgArkUdis::SetInputBuffer(const unsigned char* buffer, const size_t size) {
    if ( !IsInited() ) {
        err << wa::showminus << __FUNCTION__ << ": class is not initialized" << endlerr;
        return false;
    }

    m_buffer.reset(new unsigned char[size]);
    std::memcpy(m_buffer.get(), reinterpret_cast<const void*>(buffer), size);
    ud_set_input_buffer(&m_udis_obj, m_buffer.get(), size);
    SetInstructionPointer(0ULL);
    m_size = size;

    return true;
}
Example #12
0
// Returns
//   true if finalizing suceeded, false otherwise
// Description
//   Finalises the Narrator class by releasing the voice COM object and
//   removing the notification mechanism setup in Initialize.
bool WindowsSAPI5Narrator::Finalize(void)
{
	if(!IsInited())
		return false;

	// Release voice, if created
	if(m_cpVoice)
	{
		if (m_cpVoice->SetNotifySink(NULL) != S_OK)
			return false;

		m_cpVoice.Release();
	}	
	m_cpVoice = NULL;
	bInited = false;
	return true;
}
Example #13
0
    /// This method returns a copy of this bounding box that is slightly enlarged by Epsilon (or shrunk if Epsilon is negative).
    /// The returned box is very useful with the containment / intersection / test methods when rounding errors are an issue!
    /// Note that it is easy to control the desired effect by passing either a positive number to make the box slightly larger,
    /// or by passing a negative number to make the box slightly smaller.
    /// For example, if BB is a bounding box, BB.GetEpsilonBox(0.1).Contains(A) returns true even if A is actually a bit outside of BB,
    /// or BB.GetEpsilonBox(-0.3).Intersects(OtherBB) yields false even if BB and OtherBB are neighboured and share a plane.
    /// @param Epsilon   The amount by which the bounding-box is expanded.
    BoundingBox3T<T> GetEpsilonBox(const T Epsilon) const
    {
        assert(IsInited());

        const Vector3T<T> Eps=Vector3T<T>(Epsilon, Epsilon, Epsilon);
        BoundingBox3T<T>  BB(*this);

        // Don't use the (Min-Eps, Max+Eps) constructor here, as it involved an additional call to Insert().
        BB.Min-=Eps;
        BB.Max+=Eps;

        // Maybe the box got smaller, now make sure it didn't get negative.
        if (BB.Min.x>BB.Max.x) BB.Min.x=BB.Max.x=(BB.Min.x+BB.Max.x)*0.5f;
        if (BB.Min.y>BB.Max.y) BB.Min.y=BB.Max.y=(BB.Min.y+BB.Max.y)*0.5f;
        if (BB.Min.z>BB.Max.z) BB.Min.z=BB.Max.z=(BB.Min.z+BB.Max.z)*0.5f;

        return BB;
    }
OperaAccountManager::~OperaAccountManager()
{
	if (IsInited())
	{
#ifdef WEBSERVER_SUPPORT
		if (g_pcwebserver) g_pcwebserver->UnregisterListener(this);
#endif // WEBSERVER_SUPPORT
	
#ifdef SUPPORT_DATA_SYNC
		if (g_pcsync) g_pcsync->UnregisterListener(this);
#endif // SUPPORT_DATA_SYNC
	
		if(m_opera_authentication)
		{
			m_opera_authentication->SetListener(NULL);
			OP_DELETE(m_opera_authentication);
		}
		PrivacyManager::GetInstance()->RemoveCallback(this);
	}
}
Example #15
0
bool WDbgArk::Init() {
    if ( IsInited() )
        return true;

    CheckSymbolsPath();

    m_obj_helper = std::unique_ptr<WDbgArkObjHelper>(new WDbgArkObjHelper);
    m_color_hack = std::unique_ptr<WDbgArkColorHack>(new WDbgArkColorHack);

    // get system version
    HRESULT result = m_Control->GetSystemVersion(reinterpret_cast<PULONG>(&m_platform_id),
                                                 reinterpret_cast<PULONG>(&m_major_build),
                                                 reinterpret_cast<PULONG>(&m_minor_build),
                                                 NULL,
                                                 0,
                                                 NULL,
                                                 reinterpret_cast<PULONG>(&m_service_pack_number),
                                                 NULL,
                                                 0,
                                                 NULL);

    if ( !SUCCEEDED(result) )
        warn << __FUNCTION__ ": GetSystemVersion failed with result = " << result << endlwarn;

    m_is_cur_machine64 = IsCurMachine64();

    InitCallbackCommands();
    InitCalloutNames();
    InitGDTSelectors();

    if ( !FindDbgkLkmdCallbackArray() )
        warn << __FUNCTION__ ": FindDbgkLkmdCallbackArray failed" << endlwarn;

    m_inited = true;

    return m_inited;
}
Example #16
0
void WDbgArkColorHack::PrintInformation(void) {
    if ( !IsInited() ) {
        err << wa::showminus << __FUNCTION__ << ": class is not initialized" << endlerr;
        return;
    }

    m_tp->PrintHeader();

    for ( const auto &internal_color : m_internal_colors ) {
        std::stringstream original_color;
        original_color << std::internal << std::setw(10) << std::setfill('0');
        original_color << std::hex << std::showbase << internal_color.orig_color;

        std::stringstream new_color;
        new_color << std::internal << std::setw(10) << std::setfill('0');
        new_color << std::hex << std::showbase << internal_color.new_color;

        *m_tp << internal_color.dml_name << internal_color.description << original_color.str() << new_color.str();
        m_tp->flush_out();
        m_tp->PrintFooter();
    }

    m_tp->PrintFooter();
}
Example #17
0
 void AddColumn(const std::string &header_name, const int column_width) {
     if ( IsInited() )
         tp->AddColumn(header_name, column_width);
 }
Example #18
0
 void PrintHeader(void) { if ( IsInited() ) tp->PrintHeader(); }
Example #19
0
 void PrintFooter(void) { if ( IsInited() ) tp->PrintFooter(); }
Example #20
0
 /// Returns the center point of the BB.
 Vector3T<T> GetCenter() const { assert(IsInited()); return (Min+Max)/2; }