Added different shapes based on the type of the model or variable types

This commit is contained in:
Ankitkumar Satapara
2026-04-18 18:59:05 +05:30
parent 161370e4ce
commit 2f532a8536
2 changed files with 43 additions and 19 deletions

View File

@@ -61,13 +61,15 @@ namespace Nodify.Calculator
{ {
Title = $"{inp.Name} ({inp.Type})", Title = $"{inp.Name} ({inp.Type})",
Shape = ConnectorShape.Circle, Shape = ConnectorShape.Circle,
IsInput = false IsInput = false,
ConnectorColor = System.Drawing.Color.Gold
}); });
// Also add an outer input connector on the function node // Also add an outer input connector on the function node
Input.Add(new ConnectorViewModel Input.Add(new ConnectorViewModel
{ {
Title = $"{inp.Name} ({inp.Type})" Title = $"{inp.Name} ({inp.Type})",
ConnectorColor = System.Drawing.Color.Gold
}); });
} }
@@ -77,14 +79,16 @@ namespace Nodify.Calculator
InnerEnd.Input.Add(new ConnectorViewModel InnerEnd.Input.Add(new ConnectorViewModel
{ {
Title = $"{outp.Name} ({outp.Type})", Title = $"{outp.Name} ({outp.Type})",
Shape = ConnectorShape.Circle Shape = ConnectorShape.Circle,
ConnectorColor = System.Drawing.Color.Gold
}); });
// Also add an outer output connector on the function node // Also add an outer output connector on the function node
Output.Add(new ConnectorViewModel Output.Add(new ConnectorViewModel
{ {
Title = $"{outp.Name} ({outp.Type})", Title = $"{outp.Name} ({outp.Type})",
IsInput = false IsInput = false,
ConnectorColor = System.Drawing.Color.Gold
}); });
} }
} }

View File

@@ -213,7 +213,7 @@ namespace Nodify.Calculator
Operation = info.Operation, Operation = info.Operation,
Expression = "1 + sin {a} + cos {b}" Expression = "1 + sin {a} + cos {b}"
}; };
eo.Output.Add(new ConnectorViewModel()); eo.Output.Add(new ConnectorViewModel { ConnectorColor = Color.DodgerBlue });
return eo; return eo;
case OperationType.Calculator: case OperationType.Calculator:
return new CalculatorOperationViewModel return new CalculatorOperationViewModel
@@ -230,7 +230,8 @@ namespace Nodify.Calculator
Title = info.Title, Title = info.Title,
Operation = info.Operation Operation = info.Operation
}; };
o.Output.Add(new ConnectorViewModel()); o.Output.Add(new ConnectorViewModel { ConnectorColor = Color.DodgerBlue });
foreach (var ei in input) { ei.ConnectorColor = Color.DodgerBlue; }
o.Input.AddRange(input); o.Input.AddRange(input);
return o; return o;
@@ -265,11 +266,11 @@ namespace Nodify.Calculator
IsInput = false IsInput = false
}; };
_o.Output.Add(connectorViewModel2); _o.Output.Add(connectorViewModel2);
_o.Output.Add(new ConnectorViewModel()); _o.Output.Add(new ConnectorViewModel { ConnectorColor = Color.LimeGreen });
_o.Input.Add(connectorViewModel); _o.Input.Add(connectorViewModel);
foreach (var item in input) foreach (var item in input)
{ {
item.ConnectorColor = Color.GreenYellow; item.ConnectorColor = Color.LimeGreen;
_o.Input.Add(item); _o.Input.Add(item);
} }
//_o.Input.AddRange(input); //_o.Input.AddRange(input);
@@ -317,7 +318,7 @@ namespace Nodify.Calculator
// Add data input connectors // Add data input connectors
foreach (var inp in input) foreach (var inp in input)
{ {
inp.ConnectorColor = System.Drawing.Color.Orange; inp.ConnectorColor = Color.Orange;
authOp.Input.Add(inp); authOp.Input.Add(inp);
} }
return authOp; return authOp;
@@ -329,7 +330,7 @@ namespace Nodify.Calculator
SystemOperationType = info.sysOp SystemOperationType = info.sysOp
}; };
if (info.sysOp == SystemOperations.GET_SET && info.IsModelNode) if (info.sysOp == SystemOperations.GET_SET && info.IsModelNode && !info.IsSimpleVariable)
{ {
if (info.Title == "GET") if (info.Title == "GET")
{ {
@@ -403,24 +404,42 @@ namespace Nodify.Calculator
sysOp.Input.Add(flowinputnode); sysOp.Input.Add(flowinputnode);
sysOp.Output.Add(flowoutputnode); sysOp.Output.Add(flowoutputnode);
} }
// Determine connector shape & color based on system operation type
ConnectorShape dataShape;
System.Drawing.Color dataColor;
if (info.IsModelNode && !info.IsSimpleVariable)
{
dataShape = ConnectorShape.Square;
dataColor = Color.MediumPurple;
}
else if (info.IsSimpleVariable)
{
dataShape = ConnectorShape.Circle;
dataColor = Color.LightGreen;
}
else
{
dataShape = ConnectorShape.Circle;
dataColor = Color.Cyan;
}
foreach (var item in info.Output) foreach (var item in info.Output)
{ {
var isBeginEnd = info.sysOp == SystemOperations.BEGIN || info.sysOp == SystemOperations.END;
var out1 = new ConnectorViewModel() var out1 = new ConnectorViewModel()
{ {
Title = string.IsNullOrEmpty(item) ? "" : item, Title = string.IsNullOrEmpty(item) ? "" : item,
IsInput = false, IsInput = false,
ConnectorColor = Color.DarkRed, Shape = isBeginEnd ? ConnectorShape.Triangle : dataShape,
Shape = (info.sysOp == SystemOperations.BEGIN || info.sysOp == SystemOperations.END) ? ConnectorShape.Triangle : ConnectorShape.Circle, ConnectorColor = isBeginEnd ? Color.DarkRed : dataColor,
}; };
if (out1.Shape != ConnectorShape.Triangle)
{
out1.ConnectorColor = Color.DeepPink;
}
sysOp.Output.Add(out1); sysOp.Output.Add(out1);
} }
foreach (var item in input) foreach (var item in input)
{ {
item.Shape = (info.sysOp == SystemOperations.BEGIN || info.sysOp == SystemOperations.END) ? ConnectorShape.Triangle : ConnectorShape.Circle; var isBeginEnd = info.sysOp == SystemOperations.BEGIN || info.sysOp == SystemOperations.END;
item.Shape = isBeginEnd ? ConnectorShape.Triangle : dataShape;
item.ConnectorColor = isBeginEnd ? Color.DarkRed : dataColor;
sysOp.Input.Add(item); sysOp.Input.Add(item);
} }
return sysOp; return sysOp;
@@ -435,10 +454,11 @@ namespace Nodify.Calculator
{ {
IsInput = false, IsInput = false,
Shape = ConnectorShape.Circle, Shape = ConnectorShape.Circle,
Title = "" Title = "",
ConnectorColor = Color.DodgerBlue
}; };
op.Output.Add(ccv); op.Output.Add(ccv);
foreach (var di in input) { di.ConnectorColor = Color.DodgerBlue; }
op.Input.AddRange(input); op.Input.AddRange(input);
return op; return op;
} }