private void ProcessPlacementFile(ShapeTableBuilder builder, FeatureDescriptor featureDescriptor, PlacementFile placementFile) {
            var feature = new Feature { Descriptor = featureDescriptor };

            // invert the tree into a list of leaves and the stack
            var entries = DrillDownShapeLocations(placementFile.Nodes, Enumerable.Empty<PlacementMatch>());
            foreach (var entry in entries) {
                var shapeLocation = entry.Item1;
                var matches = entry.Item2;

                string shapeType;
                string differentiator;
                GetShapeType(shapeLocation, out shapeType, out differentiator);

                Func<ShapePlacementContext, bool> predicate = ctx => true;
                if (differentiator != "") {
                    predicate = ctx => (ctx.Differentiator ?? "") == differentiator;
                }

                if (matches.Any()) {
                    predicate =  matches.SelectMany(match => match.Terms).Aggregate(predicate, BuildPredicate);
                }

                var placement = new PlacementInfo();

                var segments = shapeLocation.Location.Split(';').Select(s => s.Trim());
                foreach (var segment in segments) {
                    if (!segment.Contains('=')) {
                        placement.Location = segment;
                    }
                    else {
                        var index = segment.IndexOf('=');
                        var property = segment.Substring(0, index).ToLower();
                        var value = segment.Substring(index + 1);
                        switch (property) {
                            case "shape":
                                placement.ShapeType = value;
                                break;
                            case "alternate":
                                placement.Alternates = new[] { value };
                                break;
                            case "wrapper":
                                placement.Wrappers = new[] { value };
                                break;
                        }
                    }
                }

                builder.Describe(shapeType)
                    .From(feature)
                    .Placement(ctx => {
                                   var hit = predicate(ctx);
                                   // generate 'debugging' information to trace which file originated the actual location
                                    if (hit) {
                                       var virtualPath = featureDescriptor.Extension.Location + "/" + featureDescriptor.Extension.Id + "/Placement.info";
                                       ctx.Source = virtualPath;
                                   }
                                   return hit;
                               }, placement);
            }
        }
        private void ProcessPlacementFile(ShapeTableBuilder builder, IFeatureInfo featureDescriptor, PlacementFile placementFile)
        {
            foreach (var entry in placementFile)
            {
                var shapeType = entry.Key;

                foreach (var filter in entry.Value)
                {
                    var matches = filter.Filters.ToList();

                    Func <ShapePlacementContext, bool> predicate = ctx => CheckFilter(ctx, filter);

                    if (matches.Any())
                    {
                        predicate = matches.Aggregate(predicate, BuildPredicate);
                    }

                    var placement = new PlacementInfo();

                    placement.Location = filter.Location;
                    if (filter.Alternates?.Length > 0)
                    {
                        placement.Alternates = new AlternatesCollection(filter.Alternates);
                    }

                    if (filter.Wrappers?.Length > 0)
                    {
                        placement.Wrappers = new AlternatesCollection(filter.Wrappers);
                    }

                    placement.ShapeType = filter.ShapeType;

                    builder.Describe(shapeType)
                    .From(featureDescriptor)
                    .Placement(ctx => predicate(ctx), placement);
                }
            }
        }
        private void generateMsg()
        {
            if (placementInfo == null)
            {
                placementInfo = new PlacementInfo();
            }

            placementInfo.companyName = dropdown_company.SelectedItem.ToString();
            placementInfo.DOR         = dateTime_date.Value;
            placementInfo.time        = (numeric_hr.Value < 10 ? "0" + numeric_hr.Value.ToString() : numeric_hr.Value.ToString()) + ":" + (numeric_min.Value < 10 ? "0" + numeric_min.Value.ToString() : numeric_min.Value.ToString()) + " " + dropdown_am_pm.SelectedItem.ToString();
            placementInfo.venue       = textBox_venue.Text;

            string msg = Labels.NOTIFY_MESSAGE;

            msg = Utility.replaceKeyword(msg, Constant.MSG_ITEM_COMPANY_NAME, placementInfo.companyName);
            msg = Utility.replaceKeyword(msg, Constant.MSG_ITEM_VENUE, placementInfo.venue);
            msg = Utility.replaceKeyword(msg, Constant.MSG_ITEM_DATE, Utility.convertDateToString(placementInfo.DOR));
            msg = Utility.replaceKeyword(msg, Constant.MSG_ITEM_TIME, placementInfo.time);
            msg = Utility.replaceKeyword(msg, Constant.MSG_ITEM_HOME_COLLEGE, Common.homeCollege);

            placementInfo.message = msg;
            text_msg_content.Text = placementInfo.message;
        }
        private void ProcessPlacementFile(ShapeTableBuilder builder, FeatureDescriptor featureDescriptor, PlacementFile placementFile)
        {
            var feature = new Feature { Descriptor = featureDescriptor };

            foreach (var entry in placementFile)
            {
                var shapeType = entry.Key;
                var matches = entry.Value;


                foreach (var filter in entry.Value)
                {
                    var placement = new PlacementInfo();
                    placement.Location = filter.Location;
                    placement.Alternates = filter.Alternates;
                    placement.Wrappers = filter.Wrappers;
                    placement.ShapeType = filter.ShapeType;

                    builder.Describe(shapeType)
                        .From(feature)
                        .Placement(ctx => CheckFilter(ctx, filter), placement);
                }
            }
        }
        private void ProcessPlacementFile(ShapeTableBuilder builder, FeatureDescriptor featureDescriptor, PlacementFile placementFile)
        {
            var feature = new Feature {
                Descriptor = featureDescriptor
            };

            // invert the tree into a list of leaves and the stack
            var entries = DrillDownShapeLocations(placementFile.Nodes, Enumerable.Empty <PlacementMatch>());

            foreach (var entry in entries)
            {
                var shapeLocation = entry.Item1;
                var matches       = entry.Item2;

                string shapeType;
                string differentiator;
                GetShapeType(shapeLocation, out shapeType, out differentiator);

                Func <ShapePlacementContext, bool> predicate = ctx => true;
                if (differentiator != "")
                {
                    predicate = ctx => (ctx.Differentiator ?? "") == differentiator;
                }

                if (matches.Any())
                {
                    predicate = matches.SelectMany(match => match.Terms).Aggregate(predicate, BuildPredicate);
                }

                var placement = new PlacementInfo();

                var segments = shapeLocation.Location.Split(';').Select(s => s.Trim());
                foreach (var segment in segments)
                {
                    if (!segment.Contains('='))
                    {
                        placement.Location = segment;
                    }
                    else
                    {
                        var index    = segment.IndexOf('=');
                        var property = segment.Substring(0, index).ToLower();
                        var value    = segment.Substring(index + 1);
                        switch (property)
                        {
                        case "shape":
                            placement.ShapeType = value;
                            break;

                        case "alternate":
                            placement.Alternates = new[] { value };
                            break;

                        case "wrapper":
                            placement.Wrappers = new[] { value };
                            break;
                        }
                    }
                }

                builder.Describe(shapeType)
                .From(feature)
                .Placement(ctx => {
                    var hit = predicate(ctx);
                    // generate 'debugging' information to trace which file originated the actual location
                    if (hit)
                    {
                        var virtualPath = featureDescriptor.Extension.Location + "/" + featureDescriptor.Extension.Id + "/Placement.info";
                        ctx.Source      = virtualPath;
                    }
                    return(hit);
                }, placement);
            }
        }
Beispiel #6
0
        private void ApplyImplementation(BuildShapeContext context, string displayType)
        {
            if (String.IsNullOrEmpty(_differentiator))
            {
                _differentiator = _prefix;
            }

            // Look into specific implementations of placements (like placement.info files)
            var placement = context.FindPlacement(_shapeType, _differentiator, displayType, context);

            // Look for mapped display type locations
            if (_otherLocations != null)
            {
                string displayTypePlacement;
                if (_otherLocations.TryGetValue(displayType, out displayTypePlacement))
                {
                    _defaultLocation = displayTypePlacement;
                }
            }

            // If no placement is found, use the default location
            if (placement == null)
            {
                placement = new PlacementInfo()
                {
                    Location = _defaultLocation
                };
            }
            else if (placement.Location == null)
            {
                // If a placement was found without actual location, use the default.
                // It can happen when just setting alternates or wrappers for instance.
                placement.Location = _defaultLocation;
            }

            // If there are no placement or it's explicitely noop then stop rendering execution
            if (String.IsNullOrEmpty(placement.Location) || placement.Location == "-")
            {
                return;
            }

            // Parse group placement.
            _groupId = placement.GetGroup() ?? _groupId;

            // If the shape's group doesn't match the currently rendered one, return
            if (!String.Equals(context.GroupId ?? "", _groupId ?? "", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            var newShape = _shapeBuilder(context);

            // Ignore it if the driver returned a null shape.
            if (newShape == null)
            {
                return;
            }

            ShapeMetadata newShapeMetadata = newShape.Metadata;

            newShapeMetadata.Prefix          = _prefix;
            newShapeMetadata.DisplayType     = displayType;
            newShapeMetadata.PlacementSource = placement.Source;
            newShapeMetadata.Tab             = placement.GetTab();

            if (_displaying != null)
            {
                newShapeMetadata.OnDisplaying(_displaying);
            }

            // The _processing callback is used to delay execution of costly initialization
            // that can be prevented by caching
            if (_processing != null)
            {
                newShapeMetadata.OnProcessing(_processing);
            }

            // Apply cache settings
            if (!String.IsNullOrEmpty(_cacheId) && _cache != null)
            {
                _cache(newShapeMetadata.Cache(_cacheId));
            }

            // If a specific shape is provided, remove all previous alternates and wrappers.
            if (!String.IsNullOrEmpty(placement.ShapeType))
            {
                newShapeMetadata.Type = placement.ShapeType;
                newShapeMetadata.Alternates.Clear();
                newShapeMetadata.Wrappers.Clear();
            }

            if (placement.Alternates != null)
            {
                foreach (var alternate in placement?.Alternates)
                {
                    newShapeMetadata.Alternates.Add(alternate);
                }
            }

            if (placement.Wrappers != null)
            {
                foreach (var wrapper in placement.Wrappers)
                {
                    newShapeMetadata.Wrappers.Add(wrapper);
                }
            }

            dynamic parentShape = context.Shape;

            if (placement.IsLayoutZone())
            {
                parentShape = context.Layout;
            }

            var position = placement.GetPosition();
            var zones    = placement.GetZones();

            foreach (var zone in zones)
            {
                if (parentShape == null)
                {
                    break;
                }

                var zoneProperty = parentShape.Zones;
                if (zoneProperty != null)
                {
                    // parentShape is a ZoneHolding
                    parentShape = zoneProperty[zone];
                }
                else
                {
                    // try to access it as a member
                    parentShape = parentShape[zone];
                }
            }

            if (String.IsNullOrEmpty(position))
            {
                parentShape.Add(newShape);
            }
            else
            {
                parentShape.Add(newShape, position);
            }
        }
Beispiel #7
0
 public void PlaceNodes(PlacementInfo placements)
 {
     OnPlacedNodes?.Invoke(placements);
 }
 internal bool TryGetPlaceTemplate(string moduleName, ModuleLayout modLayout, out PlacementInfo placement)
 {
     return(PlacementTemplates.TryGetTemplate(moduleName, modLayout, out placement));
 }
 internal void AddRouteTemplateParameters(string moduleName, SimpleRouter router, PlacementInfo placeInfo, FIRRTLNode[] nodeOrder, FIRIO[] ioOrder)
 {
     RouteTemplates.AddTemplateParameters(moduleName, router, placeInfo, nodeOrder, ioOrder);
 }
 public ShapeAlterationBuilder Placement(Func <ShapePlacementContext, bool> predicate, PlacementInfo location)
 {
     return(Configure(descriptor =>
     {
         var next = descriptor.Placement;
         descriptor.Placement = ctx => predicate(ctx) ? location : next(ctx);
     }));
 }
Beispiel #11
0
        private void buttonX3_Click(object sender, EventArgs e)
        {
            PlacementInfo placement = new PlacementInfo(listView2.CheckedItems[0].SubItems[5].Text, label1.Text, cmbName.SelectedItem.ToString(),
                                                        Convert.ToInt32(textBox1.Text.Trim()), Convert.ToInt32(textBox2.Text.Trim()), Convert.ToInt32(comboBox7.SelectedItem.ToString()),
                                                        label13.Text, listView2.CheckedItems[0].SubItems[0].Text, listView2.CheckedItems[0].SubItems[1].Text, listView2.CheckedItems[0].SubItems[4].Text
                                                        , listView2.CheckedItems[0].SubItems[2].Text, listView2.CheckedItems[0].SubItems[3].Text, 0);
            SqlHelper help        = new SqlHelper();
            DataTable dtPlacement = help.getDs("select * from Placement_Data", "Placement_Data").Tables[0];

            if (string.IsNullOrEmpty(id))
            {
                if (dtPlacement.Select("Class_ID='" + listView2.CheckedItems[0].SubItems[5].Text + "'").Length == 0)
                {
                    if (help.Insert(placement, "Placement_Data") > 0)
                    {
                        Main.fm.flashListview();
                        foreach (string supervisor in Supervisor)
                        {
                            string SpareTimeCommand = "update SpareTime_Data set IsAssigned=true where Supervisor='" + supervisor + "'" + " and Spare_Number= '" + intclassnumber + "'" + " and Spare_Day=" + day + "" + " and Spare_Week=" + week + "";
                            string TeacherCommand   = "update Teachers_Data set Class_Totality=Class_Totality+1 where Teacher='" + supervisor + "'";
                            help.Oledbcommand(SpareTimeCommand);
                            help.Oledbcommand(TeacherCommand);
                        }
                        MessageBox.Show("添加成功");
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
                else
                {
                    MessageBox.Show("请勿重复添加");
                }
            }
            else
            {
                if (help.update("Placement_Data", placement) >= 0)
                {
                    DistinctSupervisor(olds, oldsupervisors);
                    List <string> s = new List <string>();
                    List <string> j = new List <string>();
                    foreach (string a in oldsupervisors)
                    {
                        s.Add(a);
                    }
                    foreach (string b in Supervisor)
                    {
                        j.Add(b);
                    }

                    foreach (string old in oldsupervisors)
                    {
                        foreach (string news in Supervisor)
                        {
                            if (old.IndexOf(news) != -1 || news.IndexOf(old) != -1)
                            {
                                s.Remove(old);
                                j.Remove(news);
                            }
                        }
                    }
                    foreach (string supervisor in j)
                    {
                        string SpareTimeCommand = "update SpareTime_Data set IsAssigned=true where Supervisor='" + supervisor + "'" + " and Spare_Number= " + intclassnumber + "" + " and Spare_Day=" + day + "" + " and Spare_Week=" + week + "";
                        string TeacherCommand   = "update Teachers_Data set Class_Totality=Class_Totality+1 where Teacher='" + supervisor + "'";
                        help.Oledbcommand(SpareTimeCommand);
                        help.Oledbcommand(TeacherCommand);
                    }
                    //对应的督导安排情况和总听课次数做相应的修改。
                    foreach (string old in s)
                    {
                        string SpareTimeCommand = "update SpareTime_Data set IsAssigned=false where Supervisor like '" + "%" + old + "%" + "'" + " and Spare_Number= " + intclassnumber + "" + " and Spare_Day=" + day + "" + " and Spare_Week=" + week + "";
                        string TeacherCommand   = "update Teachers_Data set Class_Totality=Class_Totality-1 where Teacher like '" + "%" + old + "%" + "'";
                        help.Oledbcommand(SpareTimeCommand);
                        help.Oledbcommand(TeacherCommand);
                    }
                    Main.fm.flashListview();
                    MessageBox.Show("修改成功!");
                    oldsupervisors.Clear();
                    olds = label13.Text;
                    flashui();
                }
                else
                {
                    MessageBox.Show("修改失败!");
                }
            }
        }
 private void populatePlacementInfoBox(PlacementInfo placementInfoObj)
 {
     label_date.Text  = Utility.convertDateToString(placementInfoObj.DOR);
     label_venue.Text = Utility.getTrimText(venue);
     label_time.Text  = placementInfoObj.time;
 }
Beispiel #13
0
        public List <WirePath> PathLines(PlacementInfo placements)
        {
            try
            {
                int rerouteCount = 0;
                Dictionary <Line, int> repathCounter = new Dictionary <Line, int>();


                List <LineInfo> sortedLines = new List <LineInfo>();
                foreach ((IOInfo start, IOInfo end) in Connections.GetAllConnectionLines(placements))
                {
                    LineInfo line = new LineInfo(start, end);
                    sortedLines.Add(line);
                    repathCounter.Add(line.GetLine(), 0);
                }

                Queue <LineInfo> linesPriority = new Queue <LineInfo>(sortedLines.OrderBy(x => x.GetScore()));

                RouterBoard board = new RouterBoard(placements.SpaceNeeded);
                board.PrepareBoard(placements.UsedSpace.Values.ToList());
                board.CreateCheckpoint();

                List <WirePath> paths = new List <WirePath>();
                while (linesPriority.Count > 0)
                {
                    //Debug.WriteLine(linesPriority.Count);
                    (IOInfo start, IOInfo end) = linesPriority.Dequeue();

                    Rectangle?startRect = null;
                    Rectangle?endRect   = null;
                    if (placements.UsedSpace.ContainsKey(start.Node))
                    {
                        startRect = placements.UsedSpace[start.Node];
                    }
                    if (placements.UsedSpace.ContainsKey(end.Node))
                    {
                        endRect = placements.UsedSpace[end.Node];
                    }

                    WirePath path = PathLine(board, start, end, startRect, endRect, paths);
                    Debug.Assert(path.StartIO == start && path.EndIO == end);

                    List <WirePath> needsRepathing = new List <WirePath>();
                    foreach (var oldPath in paths)
                    {
                        if (!path.CanCoexist(oldPath))
                        {
                            needsRepathing.Add(oldPath);
                        }
                    }
                    foreach (var repath in needsRepathing)
                    {
                        LineInfo line = new LineInfo(repath.StartIO, repath.EndIO);
                        if (repathCounter[line.GetLine()]++ >= 20)
                        {
                            continue;
                        }

                        paths.Remove(repath);

                        linesPriority.Enqueue(line);
                    }
                    paths.Add(path);
                }

                RefineWirePaths(board, paths);
                return(paths);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message + Environment.NewLine + e.StackTrace);
                throw;
            }
        }
Beispiel #14
0
        private async Task ApplyImplementationAsync(BuildShapeContext context, string displayType)
        {
            // If no location is set from the driver, use the one from the context
            if (String.IsNullOrEmpty(_defaultLocation))
            {
                _defaultLocation = context.DefaultZone;
            }

            // Look into specific implementations of placements (like placement.json files and IShapePlacementProviders)
            var placement = context.FindPlacement(_shapeType, _differentiator, displayType, context);

            // Look for mapped display type locations
            if (_otherLocations != null)
            {
                string displayTypePlacement;
                if (_otherLocations.TryGetValue(displayType, out displayTypePlacement))
                {
                    _defaultLocation = displayTypePlacement;
                }
            }

            // If no placement is found, use the default location
            if (placement == null)
            {
                placement = new PlacementInfo()
                {
                    Location = _defaultLocation
                };
            }

            if (placement.Location == null)
            {
                // If a placement was found without actual location, use the default.
                // It can happen when just setting alternates or wrappers for instance.
                placement.Location = _defaultLocation;
            }

            if (placement.DefaultPosition == null)
            {
                placement.DefaultPosition = context.DefaultPosition;
            }

            // If there are no placement or it's explicitly noop then stop rendering execution
            if (String.IsNullOrEmpty(placement.Location) || placement.Location == "-")
            {
                return;
            }

            // Parse group placement.
            _groupId = placement.GetGroup() ?? _groupId;

            // If the shape's group doesn't match the currently rendered one, return
            if (!String.Equals(context.GroupId ?? "", _groupId ?? "", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            // If a condition has been applied to this result evaluate it only if the shape has been placed.
            if (_renderPredicateAsync != null && !(await _renderPredicateAsync()))
            {
                return;
            }

            var newShape = Shape = await _shapeBuilder(context);

            // Ignore it if the driver returned a null shape.
            if (newShape == null)
            {
                return;
            }

            var newShapeMetadata = newShape.Metadata;

            newShapeMetadata.Prefix          = _prefix;
            newShapeMetadata.Name            = _name ?? _differentiator ?? _shapeType;
            newShapeMetadata.Differentiator  = _differentiator ?? _shapeType;
            newShapeMetadata.DisplayType     = displayType;
            newShapeMetadata.PlacementSource = placement.Source;
            newShapeMetadata.Tab             = placement.GetTab();
            newShapeMetadata.Card            = placement.GetCard();
            newShapeMetadata.Column          = placement.GetColumn();
            newShapeMetadata.Type            = _shapeType;

            if (_displaying != null)
            {
                newShapeMetadata.OnDisplaying(_displaying);
            }

            // The _processing callback is used to delay execution of costly initialization
            // that can be prevented by caching
            if (_processing != null)
            {
                newShapeMetadata.OnProcessing(_processing);
            }

            // Apply cache settings
            if (!String.IsNullOrEmpty(_cacheId) && _cache != null)
            {
                _cache(newShapeMetadata.Cache(_cacheId));
            }

            // If a specific shape is provided, remove all previous alternates and wrappers.
            if (!String.IsNullOrEmpty(placement.ShapeType))
            {
                newShapeMetadata.Type = placement.ShapeType;
                newShapeMetadata.Alternates.Clear();
                newShapeMetadata.Wrappers.Clear();
            }

            if (placement != null)
            {
                if (placement.Alternates != null)
                {
                    newShapeMetadata.Alternates.AddRange(placement.Alternates);
                }

                if (placement.Wrappers != null)
                {
                    newShapeMetadata.Wrappers.AddRange(placement.Wrappers);
                }
            }

            var parentShape = context.Shape;

            if (placement.IsLayoutZone())
            {
                parentShape = context.Layout;
            }

            var position = placement.GetPosition();
            var zones    = placement.GetZones();

            foreach (var zone in zones)
            {
                if (parentShape == null)
                {
                    break;
                }

                if (parentShape is IZoneHolding layout)
                {
                    // parentShape is a ZoneHolding
                    parentShape = layout.Zones[zone];
                }
                else
                {
                    // try to access it as a member
                    parentShape = parentShape.GetProperty <IShape>(zone);
                }
            }

            position = !String.IsNullOrEmpty(position) ? position : null;

            if (parentShape is Shape shape)
            {
                await shape.AddAsync(newShape, position);
            }
        }
Beispiel #15
0
 public PlaceTemplate(PlacementInfo placeInfo, FIRRTLNode[] nodeOrder)
 {
     this.PlaceInfo = placeInfo;
     this.NodeOrder = GetPlacementInNodeOrder(placeInfo, nodeOrder);
 }
Beispiel #16
0
        public IDictionary <string, IEnumerable <IPlacementDeclaration> > Process(string placementDeclaration)
        {
            var placements = new Dictionary <string, IEnumerable <IPlacementDeclaration> >();

            if (string.IsNullOrEmpty(placementDeclaration))
            {
                return(placements);
            }

            placementDeclaration = placementDeclaration.Trim();

            if (!placementDeclaration.StartsWith("<Placement>"))
            {
                placementDeclaration = "<Placement>" + placementDeclaration;
            }
            if (!placementDeclaration.EndsWith("</Placement>"))
            {
                placementDeclaration += "</Placement>";
            }

            var placementFile = new PlacementParser().Parse(placementDeclaration);

            if (placementFile != null)
            {
                // Invert the tree into a list of leaves and the stack
                var entries = DrillDownShapeLocations(placementFile.Nodes, Enumerable.Empty <PlacementMatch>());
                foreach (var entry in entries)
                {
                    var shapeLocation = entry.Item1;
                    var matches       = entry.Item2;

                    string shapeType;
                    string differentiator;
                    GetShapeType(shapeLocation, out shapeType, out differentiator);

                    Func <ShapePlacementContext, bool> predicate = ctx => true;
                    if (differentiator != "")
                    {
                        predicate = ctx => (ctx.Differentiator ?? "") == differentiator;
                    }

                    if (matches.Any())
                    {
                        predicate = matches.SelectMany(match => match.Terms).Aggregate(predicate, BuildPredicate);
                    }

                    var placement = new PlacementInfo();

                    var segments = shapeLocation.Location.Split(';').Select(s => s.Trim());
                    foreach (var segment in segments)
                    {
                        if (!segment.Contains('='))
                        {
                            placement.Location = segment;
                        }
                        else
                        {
                            var index    = segment.IndexOf('=');
                            var property = segment.Substring(0, index).ToLower();
                            var value    = segment.Substring(index + 1);
                            switch (property)
                            {
                            case "shape":
                                placement.ShapeType = value;
                                break;

                            case "alternate":
                                placement.Alternates = new[] { value };
                                break;

                            case "wrapper":
                                placement.Wrappers = new[] { value };
                                break;
                            }
                        }
                    }

                    if (!placements.ContainsKey(shapeType))
                    {
                        placements[shapeType] = Enumerable.Empty <IPlacementDeclaration>();
                    }

                    placements[shapeType] = placements[shapeType].Concat(new[]
                    {
                        new PlacementDeclaration
                        {
                            Predicate = predicate,
                            Placement = placement
                        }
                    });
                }
            }

            return(placements);
        }