private RouteSegment CreateRouteSegment(dynamic routeSegment)
        {
            var mappedRouteSegment = new RouteSegment
            {
                Mrid            = new Guid(routeSegment.mrid.ToString()),
                Coord           = (JObject)routeSegment.coord is null ? null : Convert.FromBase64String(routeSegment.coord.wkb.ToString()),
                Username        = routeSegment.user_name.ToString(),
                WorkTaskMrid    = routeSegment.work_task_mrid.ToString() == string.Empty ? System.Guid.Empty : new Guid(routeSegment.work_task_mrid.ToString()),
                ApplicationName = routeSegment.application_name.ToString(),
                MarkAsDeleted   = (bool)routeSegment.marked_to_be_deleted,
                ApplicationInfo = routeSegment.application_info.ToString(),
                DeleteMe        = (bool)routeSegment.delete_me,

                LifeCycleInfo = new LifecycleInfo(
                    _infoMapper.MapDeploymentState((string)routeSegment.lifecycle_deployment_state),
                    (DateTime?)routeSegment.lifecycle_installation_date,
                    (DateTime?)routeSegment.lifecycle_removal_date
                    ),
                MappingInfo = new MappingInfo(
                    _infoMapper.MapMappingMethod((string)routeSegment.mapping_method),
                    (string)routeSegment.mapping_vertical_accuracy,
                    (string)routeSegment.mapping_horizontal_accuracy,
                    (DateTime?)routeSegment.mapping_survey_date,
                    (string)routeSegment.mapping_source_info
                    ),
                NamingInfo = new NamingInfo(
                    (string)routeSegment.naming_name,
                    (string)routeSegment.naming_description
                    ),
                SafetyInfo = new SafetyInfo(
                    (string)routeSegment.safety_classification,
                    (string)routeSegment.safety_remark
                    ),
                RouteSegmentInfo = new RouteSegmentInfo(
                    _infoMapper.MapRouteSegmentKind((string)routeSegment.routesegment_kind),
                    (string)routeSegment.routesegment_width,
                    (string)routeSegment.routesegment_height
                    )
            };

            // Make fully empty objects into nulls.
            mappedRouteSegment.LifeCycleInfo    = AreAnyPropertiesNotNull <LifecycleInfo>(mappedRouteSegment.LifeCycleInfo) ? mappedRouteSegment.LifeCycleInfo : null;
            mappedRouteSegment.MappingInfo      = AreAnyPropertiesNotNull <MappingInfo>(mappedRouteSegment.MappingInfo) ? mappedRouteSegment.MappingInfo : null;
            mappedRouteSegment.NamingInfo       = AreAnyPropertiesNotNull <NamingInfo>(mappedRouteSegment.NamingInfo) ? mappedRouteSegment.NamingInfo : null;
            mappedRouteSegment.RouteSegmentInfo = AreAnyPropertiesNotNull <RouteSegmentInfo>(mappedRouteSegment.RouteSegmentInfo) ? mappedRouteSegment.RouteSegmentInfo : null;
            mappedRouteSegment.SafetyInfo       = AreAnyPropertiesNotNull <SafetyInfo>(mappedRouteSegment.SafetyInfo) ? mappedRouteSegment.SafetyInfo : null;

            return(mappedRouteSegment);
        }
示例#2
0
    //添加安防信息状态下的子节点
    public void AddSafetyItem(SafetyInfo safeItem)
    {
        var itemRes = Resources.Load("Prefabs/SafetyInfolItem");

        if (itemRes != null)
        {
            var itemObj = Instantiate(itemRes) as GameObject;
            itemObj.transform.parent        = ShellThings.transform;
            itemObj.layer                   = gameObject.layer;
            itemObj.transform.localPosition = Vector3.zero;
            itemObj.transform.localRotation = Quaternion.identity;
            itemObj.transform.localScale    = Vector3.one;
            itemObj.name = safeItem.id.ToString();

            itemObj.GetComponent <SafetyInfolItem>().Init(safeItem);
        }
        else
        {
            Debug.Log("====AddSafetyItem==safeItem===不存在==");
        }
    }
示例#3
0
 public void Init(params object[] obj)
 {
     safeInfo = (SafetyInfo)obj[0];
     UpdateShow();
 }