Esempio n. 1
0
        private void goToRegularMovementAfterExitingStructure(clsGroundAtom refGroundAtom)
        {
            clsActivityMovement          backToNormal = RouteUtils.createActivityAndStart(refGroundAtom, (int)refGroundAtom.currentSpeed, null);
            clsPolygonOpeningEscapePoint escapePoint  = Structure.EscapePoints[exitEdgeNumber];

            PointData     closestPoint       = refGroundAtom.m_GameObject.lookForClosestRegularRoute(refGroundAtom);
            Route         route              = RouteUtils.typRouteToRoute(closestPoint.route);
            List <DPoint> trimmedRoutePoints = new List <DPoint>();

            for (int i = closestPoint.legNum; i < route.Points.Count(); i++)
            {
                trimmedRoutePoints.Add(route.Points.ElementAt(i));
            }
            route.Points = trimmedRoutePoints;
            refGroundAtom.currentStartWaypoint = closestPoint.routeIndex1;
            refGroundAtom.currentEndWaypoint   = closestPoint.routeIndex2;
            refGroundAtom.resetMovementData();
            refGroundAtom.currentSpeed = refGroundAtom.baselineSpeed;
            refGroundAtom.ChangeState(new GET_ON_SIDEWALK(backToNormal, new DPoint(escapePoint.x, escapePoint.y), route));
        }
Esempio n. 2
0
        // get polygon escape points by sql
        public static List <clsPolygonOpeningEscapePoint> getPolygonEscapePointsBySql(String sql)
        {
            try
            {
                List <clsPolygonOpeningEscapePoint> escapePoints = new List <clsPolygonOpeningEscapePoint>();

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                    using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                    {
                        DataSet   dsPol = new DataSet();
                        DataTable dtPol = new DataTable();
                        dsPol.Reset();
                        da.Fill(dsPol);
                        dtPol = dsPol.Tables[0];

                        if (dtPol == null || dtPol.Rows == null || dtPol.Rows.Count == 0)
                        {
                            return(null);
                        }

                        foreach (DataRow rowPol in dtPol.Rows)
                        {
                            clsPolygonOpeningEscapePoint escapePoint = new clsPolygonOpeningEscapePoint();
                            escapePoint.PolygonGUID    = rowPol["polygon_guid"].ToString();
                            escapePoint.polygonEdgeNum = (int)rowPol["polygon_edge_num"];
                            escapePoint.x = Convert.ToDouble(rowPol["route_x"]);
                            escapePoint.y = Convert.ToDouble(rowPol["route_y"]);
                            escapePoints.Add(escapePoint);
                        }
                    }

                return(escapePoints);
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Esempio n. 3
0
		// get polygon escape points by sql
        public static List<clsPolygonOpeningEscapePoint> getPolygonEscapePointsBySql(String sql)
        {
            try
            {
                List<clsPolygonOpeningEscapePoint> escapePoints = new List<clsPolygonOpeningEscapePoint>();

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                {
                    DataSet dsPol = new DataSet();
                    DataTable dtPol = new DataTable();
                    dsPol.Reset();
                    da.Fill(dsPol);
                    dtPol = dsPol.Tables[0];

                    if (dtPol == null || dtPol.Rows == null || dtPol.Rows.Count == 0)
                    {
                        return null;
                    }

                    foreach (DataRow rowPol in dtPol.Rows)
                    {
                        clsPolygonOpeningEscapePoint escapePoint = new clsPolygonOpeningEscapePoint();
                        escapePoint.PolygonGUID = rowPol["polygon_guid"].ToString();
                        escapePoint.polygonEdgeNum = (int)rowPol["polygon_edge_num"];
                        escapePoint.x = Convert.ToDouble(rowPol["route_x"]);
                        escapePoint.y = Convert.ToDouble(rowPol["route_y"]);
                        escapePoints.Add(escapePoint);
                    }
                }

                return escapePoints;
            }
            catch (Exception ex)
            {

            }
            return null;
        }