//--------------------------------------------------------- inline void CShapes_Buffer::Add_Arc(CSG_Shape *pBuffer, const TSG_Point &Center, double Distance, const TSG_Point &A, const TSG_Point &B) { double alpha, beta; alpha = Get_Direction(A, Center); beta = Get_Direction(B, Center); if( alpha - beta >= M_PI_180 ) { beta += M_PI_360; } Add_Arc(pBuffer, Center, Distance, alpha, beta); }
//--------------------------------------------------------- bool CD8_Flow_Analysis::On_Execute(void) { CSG_Grid Dir, Order, Basins; m_pDEM = Parameters("DEM") ->asGrid(); m_pDir = Parameters("DIRECTION") ->asGrid(); if( !m_pDir ) { m_pDir = &Dir ; Dir .Create(*Get_System(), SG_DATATYPE_Char ); Dir .Set_Name(_TL("Flow Direction" )); } m_pOrder = Parameters("ORDER") ->asGrid(); if( !m_pOrder ) { m_pOrder = &Order ; Order .Create(*Get_System(), SG_DATATYPE_Short); Order .Set_Name(_TL("Strahler Order" )); } m_pBasins = Parameters("BASIN") ->asGrid(); if( !m_pBasins ) { m_pBasins = &Basins; Basins.Create(*Get_System(), SG_DATATYPE_Short); Basins.Set_Name(_TL("Drainage Basins")); } m_Threshold = Parameters("THRESHOLD") ->asInt(); //----------------------------------------------------- Get_Direction(); Get_Order(); Get_Nodes(); Get_Basins(); Get_Segments(); //----------------------------------------------------- m_pOrder->Add(1 - m_Threshold); m_Nodes.Destroy(); return( true ); }
void Erase_Shift_Draw (void) { Erase.X = Move.Position[Move.Snake_Length-1].X; Erase.Y = Move.Position[Move.Snake_Length-1].Y; Erase.Direction = Get_Direction (Move.Position[Move.Snake_Length-2].X, Move.Position[Move.Snake_Length-2].Y, Move.Position[Move.Snake_Length-1].X, Move.Position[Move.Snake_Length-1].Y); // Shift_String (Move.Snake_Length); Move.Position[0].X = Predict.X; Move.Position[0].Y = Predict.Y; Draw.X = Predict.X; Draw.Y = Predict.Y; Draw.Direction = Predict.Direction; }
void Initialization (HDC DeviceContext, char *Argv) { //Clear Clear_String (); //Default Move.Condition = Read; Move.Snake_Length = 2; Move.Position[0].X = 12; Move.Position[0].Y = 12; Move.Position[1].X = 12; Move.Position[1].Y = 13; //Get Block File int Num = 0; char Input; FILE *Fp = fopen (Argv, "rb"); if (Fp) { for (;;) { fscanf (Fp, "[%hd:%hd]",&User_Def_Tag, &User_Def_Delay); fseek (Fp, 2, SEEK_CUR); int Cnt_Y = 0, Cnt_X = 0; if (User_Def_Tag == Intro) { for (Cnt_Y = 0; Cnt_Y < 25; Cnt_Y++) { for (Cnt_X = 0; Cnt_X < 25; Cnt_X++) { fread (&Input, 1, 1, Fp); if (Input >= '0' && Input <= '9') Draw_Square (Cnt_X, Cnt_Y, DN, Color_Set[Input-'0'], -1, -1, DN, Color_Set[Unset], 0, DeviceContext); else if (Input == ' ' || Input == '.') continue; else Cnt_X --; } } fseek (Fp, 2, SEEK_CUR); Sleep (User_Def_Delay*1000); } else if (User_Def_Tag == GameMap) { for (Cnt_Y = 0; Cnt_Y < 25; Cnt_Y++) { for (Cnt_X = 0; Cnt_X < 25; Cnt_X++) { fread (&Input, 1, 1, Fp); if (Input == '*') { Block[Num].X = Cnt_X; Block[Num].Y = Cnt_Y; Num++; } else if (Input >= '0' && Input <= '9') { Wormhole[Input-'0'].X = Cnt_X; Wormhole[Input-'0'].Y = Cnt_Y; } else if (Input == 'H') { Move.Position[0].X = Cnt_X; Move.Position[0].Y = Cnt_Y; Draw_Square (Cnt_X, Cnt_Y, UP, Color_Set[Set_Head_Color], -1, -1, UP, Color_Set[Set_Tail_Color], 0, DeviceContext); } else if (Input == 'T') { Move.Position[1].X = Cnt_X; Move.Position[1].Y = Cnt_Y; Draw_Square (Cnt_X, Cnt_Y, UP, Color_Set[Set_Head_Color], -1, -1, UP, Color_Set[Set_Tail_Color], 0, DeviceContext); } else if (Input == ' ' || Input == '.') continue; else Cnt_X --; } } break; } else break; } } Block_Length = Num; Draw.Direction = Get_Direction (Move.Position[0].X, Move.Position[0].Y, Move.Position[1].X, Move.Position[1].Y); Last_Key_Stroke = Get_Direction (Move.Position[0].X, Move.Position[0].Y, Move.Position[1].X, Move.Position[1].Y);; Create_Cookie (DeviceContext); Redraw_Screen (DeviceContext); }