예제 #1
0
//id="13988889999"
bool CDateBase::CreateTable(CString id)
{
	AdoInitRecordset();
	AdoInitCommand();

	//AfxMessageBox("create..."+id);
	if(true==SelectData(id))
	{
//		AfxMessageBox("表已经存在");
		return true;
	}
	else
	{
//		AfxMessageBox("表bu存在");
		CString szSql;
		CString id1 = "tb_"+id;
		szSql.Format("create table %s (id int auto_increment primary key auto_increment,time datetime not null,content varchar(1024))",id1);

		_variant_t vr; 
		try 
		{ 
			m_pConnection->Execute((_bstr_t)szSql,&vr,adExecuteNoRecords); 
		} 
		catch(_com_error&  e)          
		{          
//			AfxMessageBox("错误!");  
			AfxMessageBox("Create Table Erroe "+e.Description());  
			//ado.AdoClose();
			return false;          
		} 
		//去掉tb_
		//id = id.Mid(3);
		this->InsertData(id);
		//AfxMessageBox("创建表成功");
	}	
	return true;
}
예제 #2
0
void
PlotInfoAttributes::Merge(const PlotInfoAttributes &obj)
{
    data.Merge(obj.GetData());
    SelectData();
}
예제 #3
0
//------------------------------------------------------------------------------------------------------------------------------------
//
BOOL ItemCommandLoop( LPRefObj pRefSrc, ULONG ulItmID )
{
	ULONG	ulDataType = 0;
	LPRefObj	pRefItm = NULL;
	char	buf[256];
	UWORD	wSel;
	BOOL	bRet = true;

	pRefItm = GetRefChildPtr_ID( pRefSrc, ulItmID );
	if ( pRefItm == NULL ) {
		// Create Item object and RefSrc structure.
		if ( AddChild( pRefSrc, ulItmID ) == true ) {
			printf("Item object is opened.\n");
		} else {
			printf("Item object can't be opened.\n");
			return false;
		}
		pRefItm = GetRefChildPtr_ID( pRefSrc, ulItmID );
	}

	// command loop
	do {
	
		printf( "\nSelect (1-7, 0)\n" );
		printf( " 1. Select Data Object       2. Delete                   3. IsAlive\n" );
		printf( " 4. Name                     5. DataTypes                6. DateTime\n" );
		printf( " 7. StoredBytes\n" );
		printf( " 0. Exit\n>" );
		scanf( "%s", buf );
		wSel = atoi( buf );

		switch( wSel )
		{
			case 1:// Show Children
				// Select Data Object
				ulDataType = 0;
				bRet = SelectData( pRefItm, &ulDataType );
				if ( bRet == false )	return false;
				if ( ulDataType == kNkMAIDDataObjType_Image )
				{
					// reset file removed flag
					g_bFileRemoved = false;
					bRet = ImageCommandLoop( pRefItm, ulDataType );
					// If the image data was stored in DRAM, the item has been removed after reading image.
					if ( g_bFileRemoved ) {
						RemoveChild( pRefSrc, ulItmID );
						pRefItm = NULL;
					}
				}
				else if ( ulDataType == kNkMAIDDataObjType_Video )
				{
					// reset file removed flag
					g_bFileRemoved = false;
					bRet = MovieCommandLoop( pRefItm, ulDataType );
					if ( g_bFileRemoved ) {
						RemoveChild( pRefSrc, ulItmID );
						pRefItm = NULL;
					}
				}
				else if ( ulDataType == kNkMAIDDataObjType_Thumbnail )
				{
					bRet = ThumbnailCommandLoop( pRefItm, ulDataType );
				}
				if ( bRet == false )	return false;
				break;
			case 2:// Delete
				ulDataType = 0;
				bRet = CheckDataType( pRefItm, &ulDataType );
				if ( bRet == false )
				{
					puts( "Movie object is not supported.\n" );
					break;
				}
				bRet = DeleteDramCapability( pRefItm, ulItmID );
				if ( g_bFileRemoved )
				{
					// If Delete was succeed, Item object must be closed. 
					RemoveChild( pRefSrc, ulItmID );
					pRefItm = NULL;
				}
				break;
			case 3:// IsAlive
				bRet = SetBoolCapability( pRefItm, kNkMAIDCapability_IsAlive );
				break;
			case 4:// Name
				bRet = SetStringCapability( pRefItm, kNkMAIDCapability_Name );
				break;
			case 5:// DataTypes
				bRet = SetUnsignedCapability( pRefItm, kNkMAIDCapability_DataTypes );
				break;
			case 6:// DateTime
				bRet = SetDateTimeCapability( pRefItm, kNkMAIDCapability_DateTime );
				break;
			case 7:// StoredBytes
				bRet = SetUnsignedCapability( pRefItm, kNkMAIDCapability_StoredBytes );
				break;
			default:
				wSel = 0;
		}
		if ( bRet == false ) {
			printf( "An Error occured. Enter '0' to exit.\n>" );
			scanf( "%s", buf );
			bRet = true;
		}
	} while( wSel > 0 && pRefItm != NULL );

	if ( pRefItm != NULL ) {
		// If the item object remains, close it and remove from parent link.
		bRet = RemoveChild( pRefSrc, ulItmID );
	}

	return bRet;
}
예제 #4
0
void
PlotInfoAttributes::Reset()
{
    data.Reset();
    SelectData();
}
예제 #5
0
void CGraphCanvas::OnMouse( wxMouseEvent& event )
{

	int mouse_x = event.GetX();
	int mouse_y = event.GetY();


	if(event.LeftDClick())
	{
		//if ( !m_if_dragging )
		{
			SetCurrent();
			GetWorldCoordinate( m_newOrtho[0], m_newOrtho[1], mouse_x, mouse_y );
			Refresh(false);
			m_if_choseDrag = true;
		}
	}
	else if(event.RightUp())
	{
 		m_if_choseDrag = false;
// 		m_node = -1;
//		GetWorldCoordinate( m_newOrtho_pre[2], m_newOrtho_pre[3], mouse_x, mouse_y );
	}
	else if(event.RightDown())
	{
	//	GetWorldCoordinate( m_newOrtho_pre[2], m_newOrtho_pre[3], mouse_x, mouse_y );
	}
 	
	else if(event.Dragging()&&event.RightIsDown())
	{
// 		if(m_if_choseDrag==false)
// 		{
// 			GetWorldCoordinate( m_newOrtho_pre[2], m_newOrtho_pre[3], mouse_x, mouse_y );
// 			GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
// 			m_if_choseDrag = true;
// 			Refresh(false);
// 			return;
// 		}

		GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
		CDataManager *dm = GetDataManager();
		for ( t_pickset::iterator psit = dm->m_pickset.begin(); psit != dm->m_pickset.end(); psit++ )
		{

			//float pos[2];
			int offset;
			if((*psit).first==dm->m_Graph.selected_item[0])
			{
				offset = dm->map_x[(*psit).second];
				//kind = 0;
			}
			else if((*psit).first==dm->m_Graph.selected_item[1])
			{
				offset = dm->map_y[(*psit).second];
				//kind = 1;
			}

			//pos[0] = dm->m_Graph.graph_node[offset].pos[0];
			//pos[1] = dm->m_Graph.graph_node[offset].pos[1];

			
			
			dm->m_Graph.graph_node[offset].pos[0] +=(m_newOrtho[2]-m_newOrtho_pre[2]);
		    dm->m_Graph.graph_node[offset].pos[1] +=(m_newOrtho[3]-m_newOrtho_pre[3]);
		}
		GetWorldCoordinate( m_newOrtho_pre[2], m_newOrtho_pre[3], mouse_x, mouse_y );
		Refresh();

// 		if(m_node>=0)
// 		{
// 			GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
// 			CDataManager *dm =  GetDataManager();
// 			dm->m_Graph.graph_node[m_node].pos[0] = m_newOrtho[2];
// 			dm->m_Graph.graph_node[m_node].pos[1] = m_newOrtho[3];
// 			
// 			m_if_choseDrag = false;
// 		}
	}

	if ( event.MiddleDown())
	{
		if ( !m_if_dragging )
		{
			SetCurrent();
			GetWorldCoordinate( m_newOrtho[0], m_newOrtho[1], mouse_x, mouse_y );
			m_newOrtho[2] = m_newOrtho[0]; m_newOrtho[3] = m_newOrtho[1];
		}
	}
	else if ( event.Dragging() && event.MiddleIsDown() )
	{
		m_if_dragging = true;
		GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
		Refresh(false);
	}
	else if ( event.MiddleUp() )
	{
		if ( m_if_dragging )
		{
			m_if_dragging = false;
			GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
			if ( m_newOrtho[0] > m_newOrtho[2] )
			{
				m_Ortho[0] = m_newOrtho[2];
				m_Ortho[1] = m_newOrtho[0];
			}
			else
			{
				m_Ortho[0] = m_newOrtho[0];
				m_Ortho[1] = m_newOrtho[2];
			}
			if ( m_newOrtho[1] > m_newOrtho[3] )
			{
				m_Ortho[2] = m_newOrtho[3];
				m_Ortho[3] = m_newOrtho[1];
			}
			else
			{
				m_Ortho[2] = m_newOrtho[1];
				m_Ortho[3] = m_newOrtho[3];
			}
			Refresh(false);
		}
	}

	if ( event.LeftDown())
	{
		if ( !m_if_selecting )
		{
			SetCurrent();
			GetWorldCoordinate( m_newOrtho[0], m_newOrtho[1], mouse_x, mouse_y );
			m_newOrtho[2] = m_newOrtho[0]; m_newOrtho[3] = m_newOrtho[1];
		}
	}
	else if ( event.Dragging() && event.LeftIsDown() )
	{
		m_if_selecting = true;
		GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
		Refresh(false);
	}
	else if ( event.LeftUp() )
	{
		if ( m_if_selecting )
		{
			m_if_selecting = false;
			GetWorldCoordinate( m_newOrtho[2], m_newOrtho[3], mouse_x, mouse_y );
			if ( m_newOrtho[0] > m_newOrtho[2] )
			{
				float tmp = m_newOrtho[0];
				m_newOrtho[0] = m_newOrtho[2];
				m_newOrtho[2] = tmp;
			}

			if ( m_newOrtho[1] > m_newOrtho[3] )
			{
				float tmp = m_newOrtho[3];
				m_newOrtho[3] = m_newOrtho[1];
				m_newOrtho[1] = tmp;
			}
				SelectData();

 				m_newOrtho_pre[2] = m_newOrtho[2] = (m_newOrtho[0] + m_newOrtho[2])*0.5f;
 				m_newOrtho_pre[3] = m_newOrtho[3] = (m_newOrtho[1] + m_newOrtho[3])*0.5f;
				
		}
	//	GetWorldCoordinate( m_newOrtho_pre[2], m_newOrtho_pre[3], mouse_x, mouse_y );
	//	Refresh(false);
		rf->m_cf->RefreshAll();
	}


}